咕噜咕噜地看着不运行任务
Grunt watch not running tasks
我正在尝试运行一个带有livereload和更少内容的grunt服务器。在grunt less
它确实编译了我的较少文件,但是当更改较少的文件时,我得到的只是
>> File "app'style'componenets'components.less" changed.
我也尝试了更少的开发,但仍然没有运气。顺便说一句,我在我更改的每个文件上都实时加载,尽管在监视任务中我只配置了较少的位置。
提前感谢!
'use strict';
// Gruntfile with the configuration of grunt-express and grunt-open. No livereload yet!
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
console.log(__dirname + '''app''');
// Configure Grunt
grunt.initConfig({
// grunt-express will serve the files from the folders listed in `bases`
// on specified `port` and `hostname`
express: {
all: {
options: {
bases: ['app'],
port: 8080,
hostname: "0.0.0.0",
livereload: true
}
}
},
less: {
development: {
options: {
compress: true,
yuicompress: true
},
files: {
// target.css file: source.less file
"app/main.css": "app/style/main.less"
}
}
},
// grunt-watch will monitor the projects files
watch: {
less: {
files: ['<%= express.all.options.base%>/style/*.less', '<%= express.all.options.base%>/style/componenets/*.less'],
tasks: ['less']
}
},
// grunt-open will open your browser at the project's URL
open: {
all: {
// Gets the port from the connect configuration
path: 'http://localhost:<%= express.all.options.port%>/#/'
}
}
});
// Creates the `server` task
grunt.registerTask('server', [
'express',
'open',
'watch'
])
// Creates the `less` task
grunt.registerTask('less', ['less']);
};
为什么别名任务在gruntfile的末尾?
// Creates the `less` task
grunt.registerTask('less', ['less']);
您的 Less 任务已经通过您的配置定义! 删除那行,你可能很好...
编辑:您的 less 配置中至少有 1 个错别字:
错:
<%= express.all.options.base %>/style/*.less'
正确:
<%= express.all.options.bases %>/style/*.less'
相关文章:
- Gulp Git首先运行提交任务,然后运行推送任务
- 如何在jshint任务运行且一切正常时记录消息
- 如何按顺序运行gullow任务
- 如何在Grunt.js中观察多个文件,但只在更改的文件上运行任务
- 在节点.js的多个线程中运行任务
- Grunt:如何只对修改后的文件运行任务
- 咕噜咕噜地看着不运行任务
- Gulp:在没有目的地的情况下运行任务
- 我有可能让父Gruntfile.js在子Gruntfile.js上交互或运行任务吗
- Nodejs每天运行任务
- Gulp watch:根据event.type有条件地运行任务
- 运行任务前的Gulp提示
- Gulp.series()不运行任务
- JavaScript性能长时间运行任务
- 在PHP后台运行任务,即使在用户退出后
- Grunt -运行任务前动态设置配置
- 隐藏'正在运行X任务'咕哝着
- gulp4.0:串行运行任务
- 是否可以将标志传递给 Gulp 以使其以不同的方式运行任务
- 运行grunt只是打开一个记事本文件,而不是实际运行任务