gruntjs - Parameters binding in grunt tasks -
i have problem grunt tasks:
watch: { jshint: { files: ['gruntfile.js', '<%= version %>/src/**/*.js', '<%= version %>/src/*.js'], tasks: ['jshint', 'concat', 'uglify'], options: { livereload: true } } },
i call in function
grunt.registertask('server', 'a task runs server', function(version) { if (arguments.length === 0) { grunt.log.writeln("please specify version in arguments (grunt "+this.name+":version)"); } else { grunt.log.writeln(this.name + ", " + version ); grunt.config.set('version', version); grunt.task.run(['jshint', 'concat', 'uglify', 'open', 'connect', 'watch']); } });
the problem watch task can see version tasks in watch don't bind version - here
tasks: ['jshint', 'concat', 'uglify'],
outcome:
0.1\src\myjs.js" changed. \src\new.js cannot write file
the solution call
watch: { jshint: { files: ['gruntfile.js', '<%= version %>/src/**/*.js', '<%= version %>/src/*.js'], tasks: ['jshint:<%= version %>', 'concat', 'uglify'], options: { livereload: true } } },
with 'jshint:<%= version %>'
don't know why happens works
Comments
Post a Comment