Gruntjs 格朗特没有';t output main.js

Gruntjs 格朗特没有';t output main.js,gruntjs,Gruntjs,我有以下资料: module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-sass'); // Project configuration. grunt.initConfig({ pkg:

我有以下资料:

module.exports = function(grunt) {
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-sass');

    // Project configuration.
    grunt.initConfig({
        pkg: '<json:package.json>',
        concat: {
            options: {
              outputStyle: 'minified',
            },
            dist: {
              src: [
                    'js/jquery.min.js', 
                    'js/foundation.min.js',     
                    'js/header.js'
                    ],
              dest: 'js/main.js',
            },
            dist: {
                src: [
                        'scss/foundation.css', 
                        'scss/footer.scss', 
                        'scss/header.scss', 
                        'scss/off_canvas_custom.scss', 
                        'scss/projects_panel.scss', 
                        'scss/typography.scss'
                    ],
                dest: 'css/app.css',
            }
        },
        watch: {
            scripts: {
              files: [
                        'js/jquery.min.js', 
                        'js/foundation.min.js', 
                        'js/header.js'
                        ],
              tasks: ['concat']
            },

            styles: {
                files: [
                        'scss/foundation.css', 
                        'scss/footer.scss', 
                        'scss/header.scss', 
                        'scss/off_canvas_custom.scss', 
                        'scss/projects_panel.scss', 
                        'scss/typography.scss'
                    ],
                tasks: ['concat']
            }
        }

    }

);
};
module.exports=函数(grunt){
grunt.loadNpmTasks(“grunt-contrib-concat”);
grunt.loadNpmTasks(“grunt-contrib-watch”);
grunt.loadNpmTasks(“grunt-contrib-sass”);
//项目配置。
grunt.initConfig({
包装:'',
康卡特:{
选项:{
outputStyle:'缩小',
},
地区:{
src:[
“js/jquery.min.js”,
“js/foundation.min.js”,
'js/header.js'
],
dest:'js/main.js',
},
地区:{
src:[
“scss/foundation.css”,
“scss/footer.scss”,
“scss/header.scss”,
“scss/off_canvas_custom.scss”,
“scss/projects_panel.scss”,
“scss/排版。scss”
],
dest:'css/app.css',
}
},
观察:{
脚本:{
档案:[
“js/jquery.min.js”,
“js/foundation.min.js”,
'js/header.js'
],
任务:['concat']
},
风格:{
档案:[
“scss/foundation.css”,
“scss/footer.scss”,
“scss/header.scss”,
“scss/off_canvas_custom.scss”,
“scss/projects_panel.scss”,
“scss/排版。scss”
],
任务:['concat']
}
}
}
);
};
具有以下文件夹结构:

  • index.html
    • JS
    • header.js
    • jquery
    • 基础
    • CSS
    • package.json
  • 还有一些文件

    在输入终端“grunt watch”后,我在header.js中做了一些更改


    main.js根本不会被输出。假设它输出到JS文件夹中

    您的
    默认任务在哪里?您的
    concat
    任务名称相同。将javascript的选项更改为
    js
    ,然后再试一次。否则我会调查的。正如@Zamboney所说,您应该创建一个默认任务,将
    concat
    作为一个任务,然后运行它,这样我们就知道问题出在哪里了。