标签: grunt-contrib-watch

grunt throw"Recursive process.nextTick detected"

我正在使用nodejs v0.10.26运行Lion 10.9.2

我想在sass文件上设置自动编译,并使用grunt进行实时重新加载,没有什么复杂但是......

运行时grunt watch我收到以下错误

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

util.js:35
  var str = String(f).replace(formatRegExp, function(x) {
                      ^
RangeError: Maximum call stack size exceeded
Run Code Online (Sandbox Code Playgroud)

这是Gruntfile.js

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        sass: {
            dist: {
                files: {
                    'assets/css/styles.css': 'assets/sass/styles.scss'
                }
            }
        },
        watch: {
            all: {
                files: 'index.html', // Change this if you are not watching index.html
                options: …
Run Code Online (Sandbox Code Playgroud)

node.js gruntjs grunt-contrib-watch

88
推荐指数
3
解决办法
3万
查看次数

如何同时运行两个grunt监视任务

是否可以同时运行两个监视任务?

我知道我可以在手表设置中拥有任何我想要的任务,只需启动grunt手表,它就会观看所有这些,就像这样

...
watch: {
    A: {
        files: "js/dev/**/*.coffee",
        tasks: ["coffee", "requirejs"]
    },
    B: {
        files: "js/dev/**/*.coffee",
        tasks: ["coffee"]
    },
    C: {
        files: "js/dev/**/*.html",
        tasks: ["copy"]
    }
}
...
Run Code Online (Sandbox Code Playgroud)

......但我不需要这个.我只想拥有不同的开发和生产任务.你可以猜到,A(生产)和B(开发)之间的唯一区别是缩小和连接.我不需要同时启动AB任务.

首先,我提出了这个想法

grunt.registerTask("prod", ["watch:A", "watch:C"]);
grunt.registerTask("dev", ["watch:B", "watch:C"]);
Run Code Online (Sandbox Code Playgroud)

但这没效果.只是第一次观察任务正在运行(C永远不会起作用).这可能做我想要的吗?

gruntjs grunt-contrib-watch

58
推荐指数
4
解决办法
3万
查看次数

grunt手表和连接

我对grunt有点新意,想和Jekyll以及一些LESS-compiling一起使用它.

我现在的问题是,我已经完全运行LESS-comipiling with live reload and watch task并且可以通过grunt构建我的jekyll站点,但是如何运行类似于jekyll serve或grunt-connect的grunt watch同时?我想要一个笨拙的任务,提供我的LESS文件等的观看,构建jekyll网站,然后运行一个小型的Web服务器与grunt-connect或其他任何东西.

到目前为止,我的Gruntfile.js:

'use strict';
module.exports = function (grunt) {

    grunt.initConfig({
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                'js/*.js',
                '!js/scripts.min.js'
            ]
        },
        less: {
            dist: {
                files: {
                    'css/styles.min.css': [
                        'less/app.less'
                    ]
                },
                options: {
                    compress: true,
                    // LESS source map
                    // To enable, set sourceMap to true and update sourceMapRootpath based on your install
                    sourceMap: false,
                    sourceMapFilename: 'css/styles.min.css.map',
                    sourceMapRootpath: '/'
                }
            },
            dev: { …
Run Code Online (Sandbox Code Playgroud)

javascript jekyll gruntjs grunt-contrib-watch

24
推荐指数
1
解决办法
2万
查看次数

错误:找不到模块'connect-livereload'

我正在按照网站http://yeoman.io/上提供的步骤进行操作.完成所有步骤后,我面临这个错误消息`$ grunt Loading"Gruntfile.js"任务......错误

错误:找不到模块'connect-livereload'警告:找不到任务"默认".使用--force继续`

在我的package.json中,我有我所有的依赖包

"connect-livereload":"~0.2.0","grunt-google-cdn":"~0.2.0","grunt-ngmin":"~0.0.2","grunt-contrib-livereload":" 〜0.1.2"

grunt-contrib-watch

18
推荐指数
1
解决办法
1万
查看次数

如何在grunt-watch任务中忽略一个文件?

'use strict';

module.exports = function(grunt) {
    // Project Configuration
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        watch: {
            jade: {
                files: ['app/views/**'],
                options: {
                    livereload: true,
                },
            },
            js: {
                files: ['!public/build.js', 'gruntfile.js', 'server.js', 'app/**/*.js', 'public/js/**', 'test/**/*.js'],
                tasks: ['uglify', 'jshint'],
                options: {
                    livereload: true,
                },
            },
            html: {
                files: ['public/views/**'],
                options: {
                    livereload: true,
                },
            },
            css: {
                files: ['public/css/**'],
                options: {
                    livereload: true
                }
            }
        },
        jshint: {
            all: {
                src: ['!public/build.js', 'gruntfile.js', 'server.js', 'app/**/*.js', 'public/js/**', 'test/**/*.js'],
                options: {
                    jshintrc: true
                }
            } …
Run Code Online (Sandbox Code Playgroud)

gruntjs grunt-contrib-watch

14
推荐指数
2
解决办法
2万
查看次数

使用grunt-contrib-watch进行两个目录的深度单向同步.代码有效,但grunt-contrib-watch重新启动时间太慢

我有两个目录srccompiled.我想,以确保从单向的数据同步srccompiled步兵关注.作为中间步骤,我想编译*.less文件以及*.js使用ES6语法编写的文件子集.

我已经成功地编写了我需要的任务:

// NOTE: Spawn must be disabled to keep watch running under same context in order to dynamically modify config file.
watch: {
  // Compile LESS files to 'compiled' directory.
  less: {
    options: {
      interrupt: true,
      spawn: false,
      cwd: 'src/less'
    },
    files: ['**/*.less'],
    tasks: ['less']
  },
  // Copy all non-ES6/LESS files to 'compiled' directory. Include main files because they're not ES6. Exclude LESS because they're …
Run Code Online (Sandbox Code Playgroud)

javascript gruntjs grunt-contrib-watch

14
推荐指数
1
解决办法
171
查看次数

Grunt手表警告:EPERM,不允许操作

我对gruntjs和grunt-contrib-watch插件有一个非常烦人的问题.一段时间后,我无法定义,可能是半小时或两小时的工作(它是随机的)控制台吐出这个错误:

Running "watch" task
Waiting...Warning: EPERM, operation not permitted 'C:\dev\project\app\index.html~RF97bf99.TMP'
Run Code Online (Sandbox Code Playgroud)

它重复约50次,接下来:

Warning: An error occurred while processing a template (An error occurred while processing a templat
e (Maximum call stack size exceeded).).
Warning: An error occurred while processing a template (An error occurred while processing a templat
e (An error occurred while processing a template (Maximum call stack size exceeded).).).
Warning: An error occurred while processing a template (An error occurred while processing a templat
e (An error …
Run Code Online (Sandbox Code Playgroud)

gruntjs grunt-contrib-watch

13
推荐指数
2
解决办法
2万
查看次数

Grunt.js,警告:无法写入"src"文件(错误代码:EISDIR)

我有一个Gruntfile写在CoffeeScript我不断收到(Error code: EISDIR)的时候cssmin运行任务.以详细模式运行任务后,我得到以下信息:

Running "cssmin" task

Running "cssmin:src" (cssmin) task
Verifying property cssmin.src exists in config...OK
Files: assets/z.styles.concat.css.liquid -> src
Options: report=false
Reading assets/z.styles.concat.css.liquid...OK
Writing src...ERROR
Warning: Unable to write "src" file (Error code: EISDIR). Use --force to continue.
Run Code Online (Sandbox Code Playgroud)

这是我的cssmin任务:

 cssmin: 
        src: 'assets/z.styles.concat.css.liquid'
        dest: 'assets/styles.min.css.liquid'
Run Code Online (Sandbox Code Playgroud)

z.styles.concat.css.liquid被创建后concat运行,并成功输出到资产的文件夹.src属性中列出的路径是正确的.

有什么想法可以抛出错误吗?

此外,这里是整个gruntfile的connivence.

Grunt.coffee:

module.exports = (grunt) ->

# Project configuration.
  grunt.initConfig
    pkg: grunt.file.readJSON 'package.json'

    files:
      grunt:     ['gruntfile.js']
      css:       ['assets/screen.css', 'assets/styles.css.liquid']
      scss:      ['src/scss/**/*.scss'] …
Run Code Online (Sandbox Code Playgroud)

coffeescript gruntjs grunt-contrib-watch

13
推荐指数
1
解决办法
2万
查看次数

纠错后Grunt手表没有少跑

我有一个问题,Grunt Watch目前没有在编译错误纠正后重新运行任务.

我收到错误消息,但在纠正错误之后,grunt说文件已经更改,但在该点之后没有运行任务.

Grunt文件:

watch: {
        less: {
            files: ['public/assets/less/**/*.less'],
            tasks: ['css'],
            options: {
                atBegin: true,
                nospawn: true
            }
        },
        scripts: {
            files: [
                'public/assets/js/homepage.js'
            ],
            tasks: ['jsApp'],
            options: {
                nospawn: true,
            }
        }
    },
Run Code Online (Sandbox Code Playgroud)

错误日志:

>> ParseError: Unrecognised input in public/assets/less/template.less on line 114, column 31:
>> 114         @media screen and (max-width: 767px) {
>> 115             left: 0;
Warning: Error compiling public/assets/less/main.less
// ----- Corrected the file here, saved again -----
>> File "public/assets/less/template.less" changed.
Run Code Online (Sandbox Code Playgroud)

文件结束.在此之后没有任何事情.

javascript gruntjs grunt-contrib-watch

13
推荐指数
1
解决办法
595
查看次数

可以在grunt.js文件更改时重新启动gruntjs watch

当grunt.js文件发生变化时,是否可以重新启动grunt watch

用例:我现在正在构建我的grunt进程并不断更改grunt.js文件,我必须重新启动grunt.js以查看它是否有效.

gruntjs grunt-contrib-watch

12
推荐指数
1
解决办法
2863
查看次数