标签: grunt-contrib-watch

让业力服务器在grunt手表上启动

在开发过程中,我正在使用karma和grunt来监视文件更改并运行测试.

在命令行中,我希望能够简单地输入

$ grunt watch
Run Code Online (Sandbox Code Playgroud)

让业力服务器启动一次,然后每当文件发生变化时,咕噜咕噜地看着变化并运行各种任务(包括业力测试).我不想进入$ karma start.

怎么能实现这一目标?

gruntjs karma-runner grunt-contrib-watch

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

GruntJS + contrib-coffee:编译但保留文件夹结构

我正在使用GruntJSgrunt-contrib-coffee.它很棒!在Watch插件的帮助下,它甚至更好.但是我怀疑:

我有两个文件夹,一个是我的coffeescript文件,另一个是我的(编译过的)js文件.看起来像这样

root_folder
|--- public
     |--- libs
     |--- ppalmeida <= here are my .js compiled files from src_client coffeescripts
          |--- controllers
          |--- core
               |--- Main.js
          |--- models

|--- src_client <= here are my .coffee files
        |--- controllers
        |--- core
             |--- Main.coffee
        |--- models
Run Code Online (Sandbox Code Playgroud)

当我使用coffee --output --compile命令构建时,文件夹结构被保留:Coffeescript cli编译"core"文件夹并在Main.js中.

但是当我运行GruntJS时,它将所有文件放在同一个文件夹(ppalmeida)中.所以控制器,核心,模型文件被扔在同一个文件夹中,我不想要.

这是我的glob_to_multiple配置:

coffee:
        glob_to_multiple:
            expand: true,
            flatten: true,
            cwd: 'src_client/',
            src: ['**/*.coffee'],
            dest: 'public/ppalmeida/',
            ext: '.js'
Run Code Online (Sandbox Code Playgroud)

所以,最后我得到了这样的东西:

root_folder
|--- public
     |--- libs
     |--- …
Run Code Online (Sandbox Code Playgroud)

node.js coffeescript gruntjs grunt-contrib-watch

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

用 grunt 运行 php 脚本

我的服务器上有一个 php 脚本(我们称之为 /test.php)。在 Grunt 自动解析我的 SCSS 和 JS 之后,我想运行这个 test.php 脚本(它会重置我的内存缓存)。我似乎找不到办法做到这一点。有人有线索吗?

php gruntjs grunt-contrib-watch

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

为livereload配置Gruntfile.js

我正在使用Laravel作为我的后端框架,我希望在发生某些文件修改时进行实时重新加载.我仍然没有成功配置Gruntfile.js使其工作.

我想,我应该需要2个插件,grunt-contrib-watch和grunt-contrib-connect,我已经配置了Grutnfile.js如下.

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        watch: {
            options: {
                livereload: true
            },
            page: {
                files: ['*.php', '*.html'],
                tasks: ['connect']
            }
        },

        connect: {
            options: {
                port: 8000,
                protocol: 'http',
                hostname: '*',
                livereload: true
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-connect');

    grunt.registerTask('do-server', ['watch']);
    grunt.registerTask('do-connect', ['connect']);
};
Run Code Online (Sandbox Code Playgroud)

请帮助我把事情搞定,当事情变得正确时,我只需要像咕噜咕噜地运行那样连接然后grunt将为我启动浏览器或者我必须手动打开浏览器和浏览器到指定的端口???

谢谢.

gruntjs grunt-contrib-watch

0
推荐指数
1
解决办法
1374
查看次数

Grunt contrib sass NoMethodError:nil的未定义方法`<<':NilClass

我最近将我的Ruby更新为v1.9.3并更新了sass和指南针.现在,当我运行grunt-contrib-scss任务时,我收到错误:

NoMethodError: undefined method `<<' for nil:NilClass
Run Code Online (Sandbox Code Playgroud)

我不是指南针scss的专家,所以我不知道发生了什么.

sass zurb-foundation gruntjs grunt-contrib-watch

0
推荐指数
1
解决办法
1019
查看次数