咕噜咕噜的手表和手写笔

Not*_*nga 3 javascript stylus gruntjs

无法想象如何嵌套grunt 手表和手写笔编译器(livereload将在以后出现)

我也试过使用"new"grunt newer,但我的代码肯定有问题.

有什么建议吗?

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']);
Run Code Online (Sandbox Code Playgroud)

此外,如果我跑grunt watch,它运作良好,但什么都不做.并且,如果我运行grunt stylus,它完全编译我的CSS.

jak*_*lla 6

那么,在你的原代码,你正在使用的选项task时,它应该是tasks(复数).这将是我的第一个猜测.

watch: {
  stylus: {
    files: ['*/*.*'],
    tasks: ['stylus:compile'],   // This needs to be "tasks" (not "task")
    options : { livereload: true },
  },
},
Run Code Online (Sandbox Code Playgroud)

我也认为你不需要newer前面的位.