gpt4 book ai didi

gruntjs - 引用 Grunt 目标导致警告 : Object true has no method 'indexOf'

转载 作者:行者123 更新时间:2023-12-01 23:23:23 25 4
gpt4 key购买 nike

我的代码:

'use strict';
module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

//Define paths
js_src_path: 'webapp/js',
js_build_path: 'webapp/js',
css_src_path: 'webapp/css',
css_build_path: 'webapp/css',
less_src_path: 'webapp/less',
less_build_path:'webapp/less',
//Convert Less to CSS and minify if compress = true
less: {
development: {
options: {
path: ['<%= less_src_path %>'],
},
files: {
//'<%= less_build_path %>/app.css':'<%= concat.less.dest %>',
//Dynamic expansion 1:1
expand: true,
cwd: '<%= less_src_path %>',
dest: '<%= less_build_path %>',
src: '*.less',
ext: '.less.css'
}
},
production: {
options: {
path: ['<%= less_src_path %>'],
//compress: true
yuicompress: true
},
files: {
//'<%= less_build_path %>/app.css':'<%= concat.less.dest %>',
//Dynamic expansion 1:1
expand: true,
cwd: '<%= less_src_path %>',
dest: '<%= less_build_path %>',
src: '*.less',
ext: '.less.min.css'
}
}
}
});

// Load the plugin that provides the tasks.
grunt.loadNpmTasks('grunt-lib-contrib');
grunt.loadNpmTasks('grunt-contrib-less');

// Task(s).
grunt.registerTask('les', ['less']);
grunt.registerTask('proless', ['less:production']);
grunt.registerTask('devless', ['less:devevelopment']);
};

运行以下各项:

grunt les
grunt proless
grunt devless

结果:

Warning: Object true has no method 'indexOf' Use --force to continue

如果我删除任务 development:{ ... }product: { .... } 并保留内部,只需更改我的 les 调用 hit less 它工作正常。

最佳答案

我在 contrib-concat 中遇到了类似的问题。我认为这是我们双方的语法错误。

尝试在开发目标的“files”属性周围添加数组文字,如下所示:

files: [{
//'<%= less_build_path %>/app.css':'<%= concat.less.dest %>',
//Dynamic expansion 1:1
expand: true,
cwd: '<%= less_src_path %>',
dest: '<%= less_build_path %>',
src: '*.less',
ext: '.less.css'
}]

这是文档:http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

希望有帮助!

关于gruntjs - 引用 Grunt 目标导致警告 : Object true has no method 'indexOf' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18137432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com