G运行t 具有相同模块的多个任务不 运行
Grunt Multiple tasks with same module do not run
我当前的 g运行t 文件如下所示:
'use strict';
module.exports = function( grunt ) {
require('time-grunt')( grunt );
grunt.initConfig({
vNo: 'v1',
pkg: grunt.file.readJSON('package.json'),
filepath: '',
directory: ''
});
grunt.loadTasks('grunt/tasks');
grunt.loadTasks('grunt/configs');
};
当我 运行 grunt scsslint
它 运行 没问题。
module.exports = function( grunt ) {
grunt.config('scsslint', {
options: {
configFile: '.scss-lint.yml',
reporterOutput: 'scss-lint-report.xml',
colorizeOutput: true,
maxBuffer: 30000000000000000000 * 1024
},
src: ['src/bbtcom/_assets/scss/**/*']
});
grunt.loadNpmTasks('grunt-scss-lint');
};
如果我尝试 运行 grunt scsslintCalcs
我得到一个错误,
Warning: Task "scsslintCalcs" not found. Use --force to continue.
Error: Task "scsslintCalcs" not found.
at Task.run (/Users/Development/project/node_modules/grunt/lib/util/task.js:179:28)
at /Users/Development/project/node_modules/grunt/lib/grunt.js:161:39
at Array.forEach (native)
at Object.grunt.tasks (/Users/Development/projecy/node_modules/grunt/lib/grunt.js:161:9)
at Object.module.exports [as cli] (/Users/Development/project/node_modules/grunt/lib/grunt/cli.js:38:9)
at Object.<anonymous> (/usr/local/lib/node_modules/grunt-cli/bin/grunt:44:20)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
但是我的 scsslintCalcs.js
module.exports = function( grunt ) {
grunt.config('scsslintCalcs', {
options: {
configFile: '.scss-lint.yml',
reporterOutput: 'scss-lint-report-calcs.xml',
colorizeOutput: true,
maxBuffer: 30000000000000000000 * 1024
},
src: ['src/leadfusion/*.scss']
});
grunt.loadNpmTasks('grunt-scss-lint');
};
所以我不确定为什么 scsslint
有效,但其余部分无效。
是否知道出了什么问题?
我试过从任务中删除 grunt.loadNpmTasks('grunt-scss-lint');
甚至将它们重命名为 scsslint
但保留我需要的文件却没有成功
原来我没有像我想的那样注册任务。
grunt.registerTask('scsslintCalcs', function () {});
我当前的 g运行t 文件如下所示:
'use strict';
module.exports = function( grunt ) {
require('time-grunt')( grunt );
grunt.initConfig({
vNo: 'v1',
pkg: grunt.file.readJSON('package.json'),
filepath: '',
directory: ''
});
grunt.loadTasks('grunt/tasks');
grunt.loadTasks('grunt/configs');
};
当我 运行 grunt scsslint
它 运行 没问题。
module.exports = function( grunt ) {
grunt.config('scsslint', {
options: {
configFile: '.scss-lint.yml',
reporterOutput: 'scss-lint-report.xml',
colorizeOutput: true,
maxBuffer: 30000000000000000000 * 1024
},
src: ['src/bbtcom/_assets/scss/**/*']
});
grunt.loadNpmTasks('grunt-scss-lint');
};
如果我尝试 运行 grunt scsslintCalcs
我得到一个错误,
Warning: Task "scsslintCalcs" not found. Use --force to continue.
Error: Task "scsslintCalcs" not found.
at Task.run (/Users/Development/project/node_modules/grunt/lib/util/task.js:179:28)
at /Users/Development/project/node_modules/grunt/lib/grunt.js:161:39
at Array.forEach (native)
at Object.grunt.tasks (/Users/Development/projecy/node_modules/grunt/lib/grunt.js:161:9)
at Object.module.exports [as cli] (/Users/Development/project/node_modules/grunt/lib/grunt/cli.js:38:9)
at Object.<anonymous> (/usr/local/lib/node_modules/grunt-cli/bin/grunt:44:20)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
但是我的 scsslintCalcs.js
module.exports = function( grunt ) {
grunt.config('scsslintCalcs', {
options: {
configFile: '.scss-lint.yml',
reporterOutput: 'scss-lint-report-calcs.xml',
colorizeOutput: true,
maxBuffer: 30000000000000000000 * 1024
},
src: ['src/leadfusion/*.scss']
});
grunt.loadNpmTasks('grunt-scss-lint');
};
所以我不确定为什么 scsslint
有效,但其余部分无效。
是否知道出了什么问题?
我试过从任务中删除 grunt.loadNpmTasks('grunt-scss-lint');
甚至将它们重命名为 scsslint
但保留我需要的文件却没有成功
原来我没有像我想的那样注册任务。
grunt.registerTask('scsslintCalcs', function () {});