-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgruntfile.js
More file actions
84 lines (75 loc) · 2.45 KB
/
gruntfile.js
File metadata and controls
84 lines (75 loc) · 2.45 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
module.exports = function(grunt) {
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
// directory vars
jsDir : 'js/',
cssDir : 'css/',
lessDir : 'less/',
// process less to css
less: {
dev: {
files: {
"<%= cssDir %>postachio-help.css": "<%= lessDir %>postachio-help.less"
}
},
prod: {
options: {
cleancss: true
},
files: {
"<%= cssDir %>postachio-help.css": "<%= lessDir %>postachio-help.less"
}
}
},
// concatenate javascript files
concat: {
js: {
options: {
separator: ';'
},
files: {
'<%= jsDir %>postachio-help.min.js': [
'//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js',
'fonts/symbolset/ss-standard.js',
'<%= jsDir %>postachio-help.js',
]
}
}
},
// minify javascript
uglify: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %>' +
' - <%= grunt.template.today("yyyy-mm-dd") %> */\n',
mangle: false
},
js: {
files: {
'<%= jsDir %>postachio.min.js': ['<%= jsDir %>postachio.min.js']
}
}
},
// listen for changes
watch: {
options: {
nospawn: true
},
dev: {
files: ['<%= jsDir %>**/*.js', '<%= lessDir %>**/*.less'],
tasks: ['less:dev', 'concat']
},
prod: {
files: '<%= watch.dev.files %>', // same as dev above
tasks: ['less:prod', 'concat', 'uglify']
}
}
});
// grunt plugins
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
// tasks
grunt.registerTask('default', ['concat:js', 'less:dev', 'watch:dev']);
grunt.registerTask('prod', ['concat:js', 'less:prod', 'uglify:js']);
};