Tag: grunt contrib watch

手表不刷新文件更改页面(快速网站)

当我更改项目文件时,浏览器自动重新加载页面将会很好。 我有这个节点快递网站的服务器被定义在'server.js' 但是,我尝试了不同的gruntconfiguration,但没有一个导致浏览器重新加载文件更改,尽pipe“watch”任务打印一条消息说文件已更改! 这是相关的gruntconfiguration: watch: { all: { files: 'views/index.ejs', // for now only watch this file! options: { livereload: true } } }, express: { options: { background: true, error: function(err, result, code) {}, fallback: function() {}, port: 3000 delay: 0, output: ".+", debug: false }, dev: { options: { script: './server.js', node_env: 'development', […]

咕噜表不工作,并被绞死

我是新来的使用咕噜声。 我无法使用grunt手表。 以下是我的咕噜文件: module.exports = function(grunt) { module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: { my_target: { files: { 'public/admin/js/developer.min.js': ['public/admin/js/developer.js'] } } }, cssmin: { target: { files: { 'public/admin/css/developer2.min.css': ['public/admin/css/developer.css'] } } }, csslint: { strict: { options: { import: 2 }, src: ['public/admin/css/developer.css'] }, lax: { options: { […]

咕噜不返回任何东西

我以前用我以前的电脑(已经死了)的地面,现在我尝试在我的新电脑上使用它。 问题是我使用它时没有得到任何回应。 更具体的说,我已经去了Gruntfile抵制的文件夹,我运行grunt watch命令,但是我没有得到Grunt任何回应 我的命令行如下所示: merianos@merianos-pc:~/Documents/repositories/project/wp-content/themes/cours-de-musique/bower_components/bootstrap$ grunt watch merianos@merianos-pc:~/Documents/repositories/project/wp-content/themes/cours-de-musique/bower_components/bootstrap$ 另外,我试过npm list –depth=0 | grep grunt-contrib-compass命令 npm list –depth=0 | grep grunt-contrib-compass ,我得到了以下结果: npm ERR! max depth reached: btoa@1.1.2, required by bootstrap@3.3.1 npm ERR! max depth reached: grunt@0.4.5, required by bootstrap@3.3.1 npm ERR! max depth reached: glob@4.0.6, required by bootstrap@3.3.1 npm ERR! max depth reached: grunt-autoprefixer@1.0.1, […]

使用grunt-express-server和grunt-contrib-watch实时重新加载

我正在使用grunt-express-server和grunt-contrib-watch为我的开发环境获取Livereloadfunction。 但不知何故,浏览器重新加载不工作,观看任务确实听取文件的变化,但不会导致重新加载浏览器。 下面是Gruntfile.js module.exports=function(grunt){ grunt.loadNpmTasks('grunt-express-server'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.initConfig({ watch: { options: { livereload: true, }, express: { files: [ 'views/index.ejs','app.js' ], tasks: [ 'express:dev' ], options: {livereload: true, spawn: false } } } , express: { options: { port:8080 }, dev: { options: { script: 'app.js' } } } }); grunt.registerTask('serve', [ 'express:dev', 'watch' ]) } […]

Grunt – 同时执行和观看应用程序

我正在开发一个简单的节点应用程序,我碰到了这个叫做grunt-cli的工具。 在介绍到咕噜之后,我打算把它和我的应用程序一起使用。 Gruntfile.js module.exports = function(grunt){ grunt.initConfig({ execute: { target:{ src: ['app.js'] } }, watch: { scrpits: { files: ['app.js'], tasks: ['execute'], options: { spawn: false } } } }); grunt.loadNpmTasks('grunt-execute'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ['execute', 'watch']); }; 的package.json { "name": "exampleapp", "version": "1.0.0", "description": "", "main": "app.js", "scripts": { "test": "echo \"Error: no test specified\" && […]

在咕噜,如果我正在看多个文件和两个或两个以上的变化,我怎么才能只在被更改的文件上运行任务?

我有一个initConfig与这个代码: grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), watch: { options: { spawn: false }, coffee: { files: [ 'src/**/*.coffee' ], tasks: ['coffee', 'coffeelint', 'concat', 'qunit'] }, … coffee: { glob_to_multiple: { expand: true, flatten: false, cwd: '.', src: ['src/**/*.coffee'], ext: '.js' } }, … grunt.event.on('watch', function (action, filepath) { if (grunt.file.isMatch("**/*.coffee", filepath)) { grunt.config(['coffee', 'glob_to_multiple', 'src'], filepath); } […]

grunt-newer将无法正常使用Watchify

我用一堆软件包来使用Grunt for Node 。 例如jsHint , jsDoc , Browserify , Uglify … 我使用Watchify和更新的Gruntfile来运行自动化。 到现在为止还挺好。 Gruntfile,工作总是很好: module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), jshint: { all: ['my/js/files/*.js'] }, jsdoc : { dist : { src: ['my/js/files/*.js'], options: { destination: 'doc' } } }, browserify: { 'public/js/files/script.js': ['my/js/files/*.js'] }, uglify: { my_target: { files: { 'public/js/files/script.js': ['public/js/files/script.js'] […]

Grunt-contrib-watch用grunt-contrib-connect

不幸的是, grunt-contrib-watch和grunt-contrib-connect似乎并不好。 在grunt-contrib-connect 自述文件中说: 请注意,此服务器只在运行grunt时才运行。 一旦咕噜的任务完成,Web服务器停止。 这种行为可以通过Keepalive选项来改变,并且可以通过运行像grunt connect :: keepalive这样的任务来启用ad-hoc。 精细。 但是如果我想与连接服务器一起运行我的监视任务呢? 像这样: connect: { server: { options: { port: 8000, hostname: 'localhost', keepalive: true } } }, watch: { options: { livereload: true }, files: ['**'], tasks: ['connect'], } 这里, connect任务在文件改变时运行。 如果我将connect的keepalive选项设置为true,那么grunt-contrib-watch会停止监视,因为它在技术上还没有完成任务。 如果我伪造keepalive选项,那么连接服务器在完成任务后就会死亡。 是的,我可以运行命令… $ grunt connect $ grunt watch …在单独的shell中,但没有办法用一个命令来运行它们吗?

grunt-contrib-watch livereload 35729 livereload.js无法加载

我正在运行grunt-contrib-watch 0.6.1,并在我的gruntfile.js中包含了livereload块。 我还在我的html中包含了livereload.js调用: <script type="text/javascript" src="http://myste.com:35729/livereload.js"></script> 当我使用我的开发环境运行服务器似乎一切似乎开始正确。 grunt dev Running "env:dev" (env) task Running "concurrent:dev" (concurrent) task Running "nodemon:dev" (nodemon) task [nodemon] v1.2.1 [nodemon] to restart at any time, enter `rs` [nodemon] watching: *.* [nodemon] starting `node server.js` Application Started on port 3000 当我进行更改时,可以看到服务器在我的ssh控制台中重新加载,但livereload.js无法加载: 当我去的应该是http://myste.com:35729/livereload.js的端口位置,我得到的标准“网页不可用”的回应。 在http://myste.com:35729/上似乎也没有运行服务器。 我也包括我的gruntfile.js完整性 'use strict'; module.exports = function (grunt) { var […]

如何使grunt watch和grunt nodemon一起工作

我在node.js中有一个web应用程序,我想从nodemon开始,所以每次主脚本更改时,webapp都可以重新启动。 同时,我有我的咖啡脚本文件,我需要重新编译每次他们任何一个变化。 我已经设置了一个grunt-contrib-watch任务来侦听app/frontend/*.coffee文件,以分派咖啡分析器。 但是,这似乎并没有发生,因为nodemon任务也在监听。 我在nodemon ignore中设置了app/frontend/文件夹。 我也设置了nodemon并观察并发。 不过,每次我编辑咖啡脚本,咖啡任务都不会执行。 这是我的Gruntfile module.exports = function(grunt) { // Project configuration. grunt.initConfig({ concurrent: { dev: [ 'nodemon', 'watch' ], options: { logConcurrentOutput: true } }, coffee: { compile: { files: { 'app/public/app.js': ['app/frontend/*.coffee'] } } }, nodemon: { dev: { script: 'app/index.js', options: { ignore: ['app/frontend/**', 'app/public/**'] } } }, […]