咕噜表和手写笔 [英] grunt watch and stylus
问题描述
无法计算嵌套grunt watch 和 stylus 编译器(livereload将在以后出现)。
I尝试使用newgrunt newer,但是在我的代码中一定有错误。
任何建议?
grunt.initConfig({
stylus:{
compile:{
options:{
paths:['手写笔'],
导入:[
'nib / *'
]
},
文件:{
'css / style .css':'stylus / style.styl',
},
},
},
手表:{
手写笔:{
文件:['* / *。*'],
任务:['newer:stylus:compile'],
选项:{livereload:true},
},
},
});
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-newer');
grunt.registerTask('compile',['newer:stylus:all']);
另外,如果我运行 grunt watch
,它运作良好,但什么都不做。
如果我运行 grunt stylus
,它会完美地编译我的css。 / div>
那么,在你的原始代码中,当任务选项-watch#tasks>它应该是 tasks
(复数)。这是我第一次猜测。
手表:{
手写笔:{
files:['*' $ * b $ b tasks:['stylus:compile'],//这需要是任务(而不是任务)
选项:{livereload:true},
},
},
我也不认为你需要更新
位于前面。
can't figure how nesting grunt watch and stylus compiler (livereload will come later)
I tried also using the "new" grunt newer, but there must be something wrong in my code.
Any suggestion?
grunt.initConfig({
stylus: {
compile: {
options: {
paths: ['stylus'],
import: [
'nib/*'
]
},
files: {
'css/style.css': 'stylus/style.styl',
},
},
},
watch: {
stylus: {
files: ['*/*.*'],
task: ['newer:stylus:compile'],
options : { livereload: true },
},
},
});
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-newer');
grunt.registerTask('compile', ['newer:stylus:all']);
Also, if i run grunt watch
, it works good but do nothing.
And, if i run grunt stylus
, it compile my css perfectly.
Well, in your original code you are using the option task
when it should be tasks
(plural). That would be my first guess.
watch: {
stylus: {
files: ['*/*.*'],
tasks: ['stylus:compile'], // This needs to be "tasks" (not "task")
options : { livereload: true },
},
},
I also don't think you need the newer
bit in front.
这篇关于咕噜表和手写笔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!