forked from fyneworks/multifile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
138 lines (112 loc) · 3.63 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
module.exports = function(grunt) {
var package = grunt.file.readJSON('package.json');
grunt.initConfig ({
pkg: package,
sass: {
docs: {
options:{/*outputStyle: 'compressed'*/ /* cssmin will do this for us */},
files: {'docs.css' : 'docs/docs.scss'}
},
},
// ---------------------
cssmin: {
docs: {
options: {
expand: false,
processImport: true,
banner: '/* <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd hh:mm:ss") %> */',
},
files: {'docs.css': ["docs.css"]}
}
},
// ---------------------
jade: {
docs: {
options: {
data: {
pkg: package,
debug: false,
timestamp: "<%= pkg.name + ' '+ (new Date().getTime()) %>"
}
},
files: {"docs.html": ["docs/docs.jade"]}
}
},
// ---------------------
uglify: {
options: {
banner: '/* <%= pkg.name %> v<%= pkg.version %> @ <%= grunt.template.today("yyyy-mm-dd hh:mm:ss") %> */',
compress: {} /*{drop_console: true}*/,
mangle: true /*{except: ['jQuery','fwx']}*/
},
dist: {
options: {},
files: {'jQuery.MultiFile.min.js': 'jQuery.MultiFile.js'}
}
},
// ---------------------
shell: {
beep_twice: {
command: 'echo echo ',
options: {stdout: true}
}
},
// ---------------------
gitcommit: {
local: {
options: {
branch: 'dev',
message: 'Auto commit <%= pkg.name %> v<%= pkg.version %> @ <%= grunt.template.today("yyyy-mm-dd hh:mm:ss") %>'
}
},
},
gitpush: {
remote: {
options: {
branch: 'dev',
message: 'Auto deply <%= pkg.name %> v<%= pkg.version %> @ <%= grunt.template.today("yyyy-mm-dd hh:mm:ss") %>'
}
},
},
// ---------------------
watch: {
options:{
reload: true
},
jade: { files: ['package.json','docs/**/*.jade','docs/*.html'], tasks: ['jade:docs','beep'], options: {} },
scss: { files: ['docs/*.scss'], tasks: ['sass:docs','beep'], options: {} },
css: { files: ['*.css'], tasks: ['cssmin:docs','beep'], options: {} },
js: { files: ['jquery.MultiFile.js'], tasks: ['uglify:dist','beep'], options: {} }
}
});
// ---------------------
// Load required plugins
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-git');
// ---------------------
// Register common tasks and aliases
grunt.registerTask('default', ['uglify:dist']);
grunt.registerTask('build', ['uglify:dist']);
grunt.registerTask('min', ['uglify:dist']);
grunt.registerTask('css', ['sass:docs cssmin:docs']);
grunt.registerTask('doc', ['jade:docs sass:docs cssmin:docs']);
grunt.registerTask('all', ['uglify:dist jade:docs sass:docs cssmin:docs']);
grunt.registerTask('beep', ['shell:beep_twice']);
grunt.registerTask('deploy', ['gitpush:remote']);
// ---------------------
// Custom test tasks
grunt.registerTask('test', function() {
grunt.log.write('Unit tests will go here'+'\n').ok();
});
// ---------------------
// Watch for file changes and run tasks automatically
grunt.event.on('watch', function(action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
// ---------------------
};