-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
98 lines (91 loc) · 2.48 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
'use strict';
module.exports = function(grunt) {
var timestamp = grunt.template.today("yyyymmdd-HH-MM-ss");
grunt.initConfig({
browserify: {
page: {
expand: true,
flatten: true,
src: ['src/**/*.js'],
dest: 'assets/js/',
options: {
external: ['jquery'],
}
}
},
concat: {
css: {
src: [
'src/css/lxj.css',
'src/css/highlight.css',
'assets/app/_syntaxhighlighter/styles/shCore.css',
'assets/app/_syntaxhighlighter/styles/shThemeDefault2.css'
],
dest: 'assets/css/lxj.css'
},
js: {
options: {
separator: ';',
},
src: [
'assets/app/_syntaxhighlighter/scripts/shCore.js',
'assets/app/_syntaxhighlighter/scripts/shBrushJScript.js',
'assets/app/_syntaxhighlighter/scripts/shBrushCss.js',
'assets/app/_syntaxhighlighter/scripts/shBrushXml.js',
'assets/app/_syntaxhighlighter/scripts/shBrushPlain.js',
'assets/app/_syntaxhighlighter/scripts/shBrushPhp.js',
'src/js/syntaxHighlighter.js'
],
dest: 'assets/js/lxj.js'
},
},
uglify: {
options: {
mangle: {
except: ['jQuery']
},
footer: "\n/**Create by Fep at " + grunt.template.today("yyyymmdd HH:MM:ss") + "**/\n"
},
target: {
files: [{
expand: true,
src: ['assets/js/**/*.js'],
}]
}
},
cssmin: {
target: {
options: {
banner: '/* build by grunt cssmin at ' + grunt.template.today("yyyy-mm-dd HH:MM:ss") + ' */'
},
files: [{
expand: true,
src: ['assets/css/**/*.css']
}]
}
},
watch: {
options: {
persistent: true,
interval: 5007
},
browserifyJs: {
files: ['src/**/*.js'],
tasks: ['concat:js','uglify']
},
cssminw:{
files: ['src/**/*.css'],
tasks: ['concat:css','cssmin']
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-browserify');
grunt.event.on('watch', function(action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
grunt.registerTask('default', ['concat', 'uglify','cssmin', 'watch']);
};