Skip to content

Commit 3a0bc16

Browse files
committed
grunt watch
1 parent 562fcc7 commit 3a0bc16

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

Gruntfile.coffee

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = (grunt) ->
2-
JS_PATH = 'js/'
2+
JS_PATH = 'src/'
33
JS_FILE = JS_PATH+'qiniu.js'
44

55
grunt.initConfig
@@ -12,16 +12,31 @@ module.exports = (grunt) ->
1212
compress:
1313
options:
1414
report: 'min'
15-
files: [{
16-
expand: true
17-
src: [JS_FILE]
18-
}]
15+
files:
16+
'src/qiniu.min.js' : [JS_FILE]
1917
copy:
2018
main:
21-
expand: true,
22-
flatten: true,
23-
src: 'src/qiniu.js',
19+
expand: true
20+
flatten: true
21+
src: 'src/qiniu.js'
2422
dest: 'demo/js/'
23+
watch:
24+
options:
25+
livereload: true
26+
debounceDelay: 600
27+
js:
28+
files: JS_FILE
29+
tasks: 'jshint'
30+
options:
31+
spawn:false
32+
copy:
33+
files: [JS_FILE]
34+
tasks: 'copy'
35+
uglify:
36+
options:
37+
report: 'min'
38+
files: [JS_FILE]
39+
tasks: 'uglify'
2540

2641
grunt.loadNpmTasks 'grunt-contrib-watch'
2742
grunt.loadNpmTasks 'grunt-contrib-uglify'
@@ -33,10 +48,12 @@ module.exports = (grunt) ->
3348

3449
grunt.registerTask 'production', [
3550
'jshint'
51+
'copy'
3652
'uglify:compress'
3753
]
3854

3955
grunt.registerTask 'default', [
4056
'jshint'
4157
'copy'
58+
'uglify:compress'
4259
]

0 commit comments

Comments
 (0)