-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
144 lines (141 loc) · 3.68 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
module.exports = function(grunt) {
var version = grunt.file.readJSON('package.json').version;
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
cssmin: {
combine: {
files: {
'build/css/is-ui.min.css': ['src/vendor/normalize.css', 'src/css/**.css', 'src/css/*/**.css']
}
}
},
concat: {
css: {
src: ['src/vendor/normalize.css', 'src/css/**.css', 'src/css/*/**.css'],
dest: 'build/css/is-ui.css'
},
js: {
src: ['src/js/**.js'],
dest: 'build/js/is-ui.js'
},
less: {
src: ['src/less/var.less', 'src/less/**/*.less'],
dest: 'build/less/is-ui.css'
}
},
uglify: {
my_target: {
files: {
'build/js/is-ui.min.js': ['src/js/**.js']
}
}
},
watch: {
css: {
files: ['src/css/**.css', 'src/css/*/**.css'],
tasks: ['cssmin', 'concat', 'compress'],
options: {
livereload: 5050,
},
},
js: {
files: 'src/js/**.js',
tasks: ['uglify', 'concat', 'compress'],
options: {
livereload: 5050
}
},
less: {
files: 'src/less/**/**.less',
tasks: ['concat:less', 'less'],
options: {
livereload: 5050
}
}
},
compress: {
main: {
options: {
archive: function(){
return 'dist/is-ui.' + version + '.zip';
}
},
files: [
{src: ['build/js/**.js'], flatten: true},
{src: ['build/css/**.css'], flatten: true},
{src: ['build/include/**'], flatten: true}
]
}
},
bump: {
options: {
files: ['package.json'],
updateConfigs: [],
commit: false,
createTag: false,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: false,
pushTo: '',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
}
},
csslint: {
options: {
formatters: [
{id: 'csslint-xml', dest: 'report/csslint.xml'}
]
},
strict: {
options: {
import: 2
},
src: ['src/**/*.css']
},
lax: {
options: {
import: false
},
src: ['src/**/*.css']
}
},
less: {
development: {
files: {
"build/less/is-ui.css": "build/less/is-ui.css"
}
},
production: {
options: {
paths: ["assets/css"],
cleancss: false,
// modifyVars: {
// imgPath: '"http://mycdn.com/path/to/images"',
// bgColor: 'red'
// }
},
files: {
"build/less/is-ui.css": "build/less/is-ui.css"
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-bump');
// npm install grunt-bump --save-dev
// Default task(s).
grunt.registerTask('default', ['cssmin', 'uglify', 'concat', 'watch']);
grunt.registerTask('patch', ['cssmin', 'uglify', 'concat', 'bump:patch']);
grunt.registerTask('minor', ['cssmin', 'uglify', 'concat', 'bump:minor']);
grunt.registerTask('major', ['cssmin', 'uglify', 'concat', 'bump:major']);
grunt.registerTask('build', ['compress']);
grunt.registerTask('lint', ['csslint']);
grunt.registerTask('l', ['concat:less', 'less', 'watch:less']);
};