-
Notifications
You must be signed in to change notification settings - Fork 35
/
Gruntfile.js
executable file
·108 lines (94 loc) · 2.24 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/needsharebutton.js', dest: 'dist/needsharebutton.js', filter: 'isFile'}
]
}
},
// minify JS
uglify: {
scripts: {
files: {
'dist/needsharebutton.min.js': 'dist/needsharebutton.js'
}
}
},
// compile LESS
less: {
styles: {
options: {
plugins: [
require('less-plugin-glob')
]
},
files: {
'dist/needsharebutton.css': 'src/less/needsharebutton.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/needsharebutton.css', 'dist/needsharebutton.css']
}
},
// beautify CSS
csscomb: {
styles: {
options: {
config: 'csscomb.json'
},
files: {
'dist/needsharebutton.css': 'dist/needsharebutton.css'
}
}
},
// concat and minify CSS
cssmin: {
styles: {
files: {
'dist/needsharebutton.min.css': 'dist/needsharebutton.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: 8002
}
}
}
});
// 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']);
};