-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathGruntfile.js
More file actions
125 lines (122 loc) · 3.69 KB
/
Gruntfile.js
File metadata and controls
125 lines (122 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
mangle: {
except: ['jQuery', '$', 'angular', 'Modernizr']
},
compress: true,
beautify: false
},
build: {
files: {
'static/build/ohe.min.js': ['static/js/*.js'],
}
},
build_deps: {
options: {
mangle: false,
compress: false,
beautify: false
},
files: {
'static/build/deps.min.js': ['static/angular-ui/angular-ui.min.js',
'static/underscore/underscore-min.js', 'static/bootstrap/js/bootstrap.min.js',
'static/select2/select2.min.js', 'static/js/modernizr.js',
'static/iscroll/src/iscroll-lite.js', 'static/moment/moment.min.js']
}
}
},
ngtemplates: {
app: {
options: {base: 'static/templates'},
src: ['static/templates/**.html'],
dest: 'static/build/templates.js'
}
},
sass: {
build: {
options: {
style: 'compressed',
loadPath: ['static/scss-deps'],
noCache: true
},
files: {
'static/build/ohe.min.css': 'static/scss/product.scss'
}
},
build_deps: {
options: {
style: 'compressed',
noCache: true
},
files: {
// hacked these file extensions from .css to .scss so grunt-sass-contrib will work (have a pull-request to fix this)
'static/build/deps.min.css': ['static/angular-ui/angular-ui.scss', 'static/select2/select2.scss']
}
},
build_dev: {
options: {
style: 'expanded',
loadPath: ['static/scss-deps'],
noCache: true
},
files: {
'static/build/ohe.min.css': 'static/scss/product.scss'
}
},
build_deps_dev: {
options: {
style: 'expanded',
noCache: true
},
files: {
// hacked these file extensions from .css to .scss so grunt-sass-contrib will work (have a pull-request to fix this)
'static/build/deps.min.css': ['static/angular-ui/angular-ui.scss', 'static/select2/select2.scss']
}
}
},
copy: {
build: {
files: [
{expand: true, flatten: true, src: ['static/select2/select2.png', 'static/select2/spinner.gif'], dest: 'static/dist/'}
]
}
},
hash: {
src: 'static/build/*.*',
mapping: 'asset_map.json',
dest: 'static/dist/'
},
watch: {
js: {
files: ['static/js/*.js'],
tasks: ['uglify:build', 'hash']
},
js_deps: {
files: ['static/angular-ui/*.js', 'static/underscore/*.js',
'static/bootstrap/js/*.js', 'static/select2/*.js'],
tasks: ['uglify:build_deps', 'hash']
},
css: {
files: ['static/scss/*.scss'],
tasks: ['sass:build_deps_dev', 'sass:build_dev', 'hash']
},
templates: {
files: ['static/templates/*.html'],
tasks: ['ngtemplates', 'hash']
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-angular-templates');
grunt.loadNpmTasks('grunt-hash');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['sass', 'ngtemplates', 'uglify', 'copy', 'hash']);
grunt.registerTask('dev', ['sass:build_deps_dev', 'sass:build_dev', 'ngtemplates', 'uglify', 'copy', 'hash'])
};