Coffeescript 什么是;正在验证配置中是否存在属性;你的意思是咕哝?
我用咖啡脚本写了一个简单的Gruntfile:Coffeescript 什么是;正在验证配置中是否存在属性;你的意思是咕哝?,coffeescript,gruntjs,grunt-contrib-copy,Coffeescript,Gruntjs,Grunt Contrib Copy,我用咖啡脚本写了一个简单的Gruntfile: "use strict" module.exports = (grunt) -> config = src: "app" dist: "build" grunt.initConfig = config: config copy: dist: files: [ ex
"use strict"
module.exports = (grunt) ->
config =
src: "app"
dist: "build"
grunt.initConfig =
config: config
copy:
dist:
files: [
expand: true
cwd: "<%= config.app %>"
dest: "<%= config.dist %>"
src: [
"*.{ico,png}"
"{*/}*.html"
]
]
grunt.loadNpmTasks "grunt-contrib-copy"
grunt.registerTask "build", [
"copy:dist"
]
grunt.registerTask "default", [
"build"
]
这也是指什么?似乎存在copy.dist,为什么不读取它
此外,我假设这是一个Coffeescript格式问题,因为用Javascript编写的等效Grunfile不会引发此问题:
"use strict";
module.exports = function (grunt) {
// Configurable paths
var config = {
scr: "app",
dist: "build"
}
grunt.initConfig({
// Project settings
config: config,
copy: {
dist: {
files: [{
expand: true,
cwd: "<%= config.app %>",
dest: "<%= config.dist %>",
src: [
"*.{ico,png}",
"{*/}*.html"
]
}]
}
}
});
// Install plugins
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.registerTask("build", [
"copy:dist"
]);
grunt.registerTask("default", [
"build"
]);
};
“严格使用”;
module.exports=函数(grunt){
//可配置路径
变量配置={
scr:“应用程序”,
地区:“建造”
}
grunt.initConfig({
//项目设置
config:config,
副本:{
地区:{
档案:[{
是的,
化学武器:,
目的地:“,
src:[
“*.{ico,png}”,
“{*/}*.html”
]
}]
}
}
});
//安装插件
grunt.loadNpmTasks(“grunt contrib副本”);
grunt.registerTask(“构建”[
“副本:dist”
]);
grunt.registerTask(“默认值”[
“构建”
]);
};
在您的配置块中,我看不到config.app
,我只能看到包含字符串的config.src(“app”
)
所以我会尝试将cwd:
切换到cwd:
希望这会有帮助。谢谢,接得好!不幸的是,同样的错误仍然存在。
"use strict";
module.exports = function (grunt) {
// Configurable paths
var config = {
scr: "app",
dist: "build"
}
grunt.initConfig({
// Project settings
config: config,
copy: {
dist: {
files: [{
expand: true,
cwd: "<%= config.app %>",
dest: "<%= config.dist %>",
src: [
"*.{ico,png}",
"{*/}*.html"
]
}]
}
}
});
// Install plugins
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.registerTask("build", [
"copy:dist"
]);
grunt.registerTask("default", [
"build"
]);
};