Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 咕噜手表和手写笔_Javascript_Gruntjs_Stylus - Fatal编程技术网

Javascript 咕噜手表和手写笔

Javascript 咕噜手表和手写笔,javascript,gruntjs,stylus,Javascript,Gruntjs,Stylus,无法计算嵌套gruntwatch和stylus编译器的方式(livereload将稍后提供) 我也尝试过使用“new”grunt-newer,但我的代码中一定有错误 有什么建议吗 grunt.initConfig({ stylus: { compile: { options: { paths: ['stylus'], import: [ 'nib/*' ] }, f

无法计算嵌套gruntwatchstylus编译器的方式(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']);
另外,如果我运行
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 },
  },
},
我也不认为您需要前面的
较新的