Javascript 咕噜手表和手写笔
无法计算嵌套gruntwatch和stylus编译器的方式(livereload将稍后提供) 我也尝试过使用“new”grunt-newer,但我的代码中一定有错误 有什么建议吗Javascript 咕噜手表和手写笔,javascript,gruntjs,stylus,Javascript,Gruntjs,Stylus,无法计算嵌套gruntwatch和stylus编译器的方式(livereload将稍后提供) 我也尝试过使用“new”grunt-newer,但我的代码中一定有错误 有什么建议吗 grunt.initConfig({ stylus: { compile: { options: { paths: ['stylus'], import: [ 'nib/*' ] }, f
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']);
另外,如果我运行grunt-watch
,它工作正常,但什么也不做。
而且,如果我运行grunt stylus,它可以完美地编译我的css。我自己解决了,但我不知道是什么错误
pkg: grunt.file.readJSON('package.json'),
stylus: {
all: {
options: {
paths: ['stylus'],
import: [ // @import 'foo', 'bar/moo', etc. into every .styl file
'nib/*'
]
},
files: {
'css/style.css': 'stylus/style.styl', // 1:1 compile
},
},
},
watch: {
files: [
'stylus/*.styl',
],
tasks: ['stylus:all'],
}
});
那么,在您的原始代码中,您使用的是选项
task
when(复数)。这是我的第一个猜测
watch: {
stylus: {
files: ['*/*.*'],
tasks: ['stylus:compile'], // This needs to be "tasks" (not "task")
options : { livereload: true },
},
},
我也不认为您需要前面的较新的位