-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·108 lines (94 loc) · 2.27 KB
/
Gruntfile.js
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
'use strict';
module.exports = function( grunt ) {
// tasks
grunt.initConfig({
// move JS to dist
copy: {
main: {
files: [
{src: 'src/js/needsectionscroll.js', dest: 'dist/needsectionscroll.js', filter: 'isFile'}
]
}
},
// minify JS
uglify: {
scripts: {
files: {
'dist/needsectionscroll.min.js': 'dist/needsectionscroll.js'
}
}
},
// compile LESS
less: {
styles: {
options: {
plugins: [
require('less-plugin-glob')
]
},
files: {
'dist/needsectionscroll.css': 'src/less/needsectionscroll.less'
}
}
},
// autoprefix CSS
autoprefixer: {
options: {
browsers: ['> 1%', 'Android 2', 'last 2 versions', 'Firefox ESR', 'Opera 12.1', 'ie 7', 'ie 8', 'ie 9']
},
no_dest: {
src: ['dist/needsectionscroll.css', 'dist/needsectionscroll.css']
}
},
// beautify CSS
csscomb: {
styles: {
options: {
config: 'csscomb.json'
},
files: {
'dist/needsectionscroll.css': 'dist/needsectionscroll.css'
}
}
},
// concat and minify CSS
cssmin: {
styles: {
files: {
'dist/needsectionscroll.min.css': 'dist/needsectionscroll.css'
}
}
},
// watch
watch: {
scripts: {
files: ['src/js/*.js'],
tasks: ['copy','uglify']
},
styles: {
files: ['src/less/*.less'],
tasks: ['less','autoprefixer', 'csscomb', 'cssmin']
}
},
// local server
connect: {
server: {
options: {
port: 8000
}
}
}
});
// download plugins
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-csscomb');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-contrib-connect');
// some default tasks
grunt.registerTask('default', ['copy', 'uglify', 'less', 'autoprefixer', 'csscomb', 'cssmin']);
grunt.registerTask('server', ['connect', 'watch']);
};