This repository has been archived by the owner on Jan 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
98 lines (94 loc) · 3.05 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
files: ['Gruntfile.js', 'scripts/src/*.js', 'scripts/src/**/*.js'],
options: {
globals: {
console: true,
document: true
}
}
},
requirejs: {
compile: {
options: {
baseUrl: 'scripts/src',
name: 'init',
out: 'scripts/build/intermediate.js',
optimize: 'none',
wrapShim: true,
inlineText: true
}
}
},
'regex-replace': {
compile: {
src: ['<%= requirejs.compile.options.out %>'],
actions: [
{
name: 'definition-start',
search: new RegExp(
/define\('(.+?)',\[.*?\], *function \((.*?)\) \{/g),
replace: 'var $1 = (function ($2) {',
},
{
name: 'definition-end',
search: new RegExp(/^\}\);$/mg),
replace: '})();',
},
]
}
},
concat: {
options: {
separator: '',
},
compile: {
src: [
'scripts/build/wrap-start.js',
'<%= requirejs.compile.options.out %>',
'scripts/build/wrap-end.js'
],
dest: 'scripts/build/skinmenu.js',
},
},
less: {
compile: {
options: {
paths: ['styles/src']
},
files: {
'styles/build/base.css': 'styles/src/base.less',
'styles/build/theme.basic.css': 'styles/src/theme.basic.less'
}
}
},
clean: {
intermediary: {
src: ['<%= requirejs.compile.options.out %>']
}
},
watch: {
js: {
files: ['<%= jshint.files %>', 'scripts/build/wrap-*.js'],
tasks: ['scripts']
},
less: {
files: ['styles/src/*.less', 'styles/lib/*.less'],
tasks: ['styles']
}
},
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-regex-replace');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('scripts', ['jshint', 'requirejs', 'regex-replace',
'concat', 'clean:intermediary']);
grunt.registerTask('styles', ['less']);
grunt.registerTask('default', ['scripts', 'styles']);
};