【发布时间】:2014-12-08 17:25:49
【问题描述】:
我正在尝试运行一个带有 livereload 和更少的 grunt 服务器。
在grunt less 上,它确实编译了我的less 文件,但是当更改一个less 文件时,我得到的只是
>> File "app\style\componenets\components.less" changed.
我也尝试了 less:development 但仍然没有运气。 顺便说一句,我更改的每个文件都得到了 livereload,尽管在监视任务中我只配置了较少的位置..
提前致谢!
'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']);
};
【问题讨论】:
标签: javascript node.js gruntjs less