简体   繁体   English

加载“Gruntfile.js”任务...错误

[英]Loading“Gruntfile.js”tasks…ERROR

'use strict';

module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);

require('time-grunt')(grunt);

var config = {
    app:'app',
    dist:'dist'
}

grunt.initConfig({
    config: config,

    copy: {
        dist_html: {
            src:'<%= config.app %>/index.html',
            dest:'<%= config.dist %>/index.html'
        },
        dist_js: {
            src:'<%= config.app %>/js/index.js',
            dest:'<%= config.dist %>/js/index.js'
        }
    },

    clean: {
        dist: {
            src: '<%= config.dist %>/index.html'
        }
    }
});}}

cmd picture I input “grunt copy”in cmd,but it error.I started to learn grunt soon,How can I solve this problem?I need help,thinks. cmd图片我在cmd中输入“grunt copy”,但是它出错了。我很快就开始学习咕噜声,我怎么能解决这个问题?我需要帮助,想一想。

You need to register the task to be able to use it in cmd. 您需要注册任务才能在cmd中使用它。

For example: 例如:

grunt.registerTask(taskName, [description, ] taskFunction)

you only have configured what pathes to use you should create a task like so: 你只配置了要使用的pathes你应该像这样创建一个任务:

grunt.task({
 // Do Stuff here
})

There is more information on grunt tasks here: http://gruntjs.com/api/grunt.task 这里有关于grunt任务的更多信息: http//gruntjs.com/api/grunt.task

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM