我想用生活记录写我的Gruntfile.js。
我做了Gruntfile.js和Gruntfile.coffee,它们都是开箱即用的
Gruntfile.ls应该能工作..。对吗?
我在网上看到了一些Gruntfile.ls,或者它是否需要编译( .coffee版本除外)?
Livescript
(调用$ grunt时出错)
A valid Gruntfile could not be found. Please see the getting started guide for
more information on how to configure grunt: http://gruntjs.com/getting-started
Fatal error: Unable to find Gruntfile.Gruntfile.ls
#global module:false
module.exports = (grunt) ->
# Project configuration.
grunt.init-config {}=
meta:
version: \0.0.1
livescript:
src:
files:
"build/js/main.js": "src/scripts/main.ls"
watch:
livescript:
files: <[src/scripts/**/*.ls]>
tasks: <[livescript]>
options: {+livereload}
# load tasks
grunt.loadNpmTasks \grunt-livescript
grunt.loadNpmTasks \grunt-contrib-watch
# register tasks
grunt.registerTask \default, <[livescript]>汇编:
(调用$ grunt时起作用)
Gruntfile.js
module.exports = function(grunt){
grunt.initConfig({
meta: {
version: '0.0.1'
},
livescript: {
src: {
files: {
"build/js/main.js": "src/scripts/main.ls"
}
}
},
watch: {
livescript: {
files: ['src/scripts/**/*.ls'],
tasks: ['livescript'],
options: {
livereload: true
}
}
}
});
grunt.loadNpmTasks('grunt-livescript');
grunt.loadNpmTasks('grunt-contrib-watch');
return grunt.registerTask('default', ['livescript']);
};发布于 2014-04-03 22:50:32
使用这个作为您的Gruntfile.js
require('LiveScript');
module.exports = function (grunt) {
require('./Gruntfile.ls')(grunt);
}需要来自npm的LiveScript包。
发布于 2014-04-10 08:02:40
我更喜欢将主Gruntfile保存在js中,任务保留在ls中。
示例设置:
require("LiveScript")
module.exports = function(grunt){
require('load-grunt-tasks')(grunt) // autoload npmtasks from package.json
require('load-grunt-config')(grunt) // lets you keep each task in separate file
}实际上,我使用了位于load-grunt-config上的https://github.com/wolfflow/load-grunt-config/tree/beta/0.8.0的分叉
如果您想尝试,只需将以下字符串添加到package.json文件中:
"load-grunt-config": "git://github.com/wolfflow/load-grunt-config.git#beta/0.8.0"然后运行npm install。
https://stackoverflow.com/questions/22849377
复制相似问题