Grunt - 在观看Gruntfile.js时观看ENOENT失败

时间:2015-06-30 09:44:43

标签: javascript gruntjs grunt-contrib-watch

这是我的Gruntfile配置:

GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] screens = ge.getScreenDevices();

当我跑步" Grunt默认"控制台在目录上打印出ENOENT错误,我甚至都没有一直在观看:

"警告:ENOENT,没有此类文件或目录' /工作/丰田/供应商'"

如果我评论观看:grunt一切正常

"use static";

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

require('jit-grunt')(grunt, {
    "autoprefixer" : "grunt-autoprefixer",
    "usebanner" : "grunt-banner",
    "browserSync": "grunt-browser-sync",
    "copy" : "grunt-contrib-copy",
    "cssmin" : "grunt-contrib-cssmin",
    "imagemin" : "grunt-contrib-imagemin",
    "jshint" : "grunt-contrib-jshint",
    "uglify" : "grunt-contrib-uglify",
    "watch" : "grunt-contrib-watch",
    "newer" : "grunt-newer",
    "sass" : "grunt-sass"
});

grunt.loadNpmTasks('grunt-notify');




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

    dir: {
        js_dev: 'assets/js',
        js_app: 'web/app/js',
        js_index: 'web/js',
        sass: 'assets/scss',
        css: 'web/app/css',
        css_index: 'web/css',
        img_dev: 'assets/img',
        img_app: 'web/app/img'
    },


// C S S
    sass: {
        options: {
            includePaths: [
                'bower_components/foundation/scss'
            ],
            sourceMap: true
        },
        dist: {
            files: {
                '<%= dir.css %>/main.css': '<%= dir.sass %>/app.scss'
            }
        }
    },

    cssmin: {
        combine: {
            options: {
                keepSpecialComments: 0,
                sourceMap: true
            },
            files: {
                '<%= dir.css %>/main.css': ['<%= dir.css %>/main.css']
            }
        }
    },

    autoprefixer: {
        files: {
            options: {
                browsers: ['last 2 versions', 'ie 9'],
                map: true
            },
            src: '<%= dir.css %>/main.css'
        }
    },



// J A V A S C R I P T
    uglify: {
        dev: {
            options: {
                sourceMap: true
            },
            files: {
                '<%= dir.js_app %>/main.js':
                [
                    'bower_components/jquery/dist/jquery.js',
                    'bower_components/foundation/js/foundation.js',
                    '<%= dir.js_dev %>/app.js'
                ]
            }
        },
        prod: {
            files: {
                '<%= dir.js_app %>/main.js':
                [
                    'bower_components/jquery/dist/jquery.js',
                    'bower_components/foundation/js/foundation.js',
                    '<%= dir.js_dev %>/app.js'
                ]
            }
        }
    },

    jshint: {
        options: {
            jshintrc: true
        },
        files: ['<%= dir.js_dev %>/**/*.js']
    },



// I M A G E S
    imagemin: {
        dynamic: {
            files: [{
                expand: true,
                cwd: '<%= dir.img_dev %>/',
                src: ['**/*.{png,jpg,jpeg,gif,svg}'],
                dest: '<%= dir.img_app %>/'
            }]
        }
    },



// O T H E R
    usebanner: {
        css: {
            options: { banner: '/*! <%= pkg.name %> - <%= pkg.authors %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n' },
            files: { src: [ '<%= dir.css %>/main.css' ] }
        },
        js: {
            options: { banner: '/*! <%= pkg.name %> - <%= pkg.authors %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n' },
            files: { src: [ '<%= dir.js_app %>/main.js' ] }
        },
        build_scss: {
            options: { banner: '@import "settings";\n' },
            files: { src: [ '<%= dir.sass %>/app.scss' ] }
        }
    },

    copy: {
        js_vendor: {
            files: [
                { src: ['bower_components/backbone/backbone.js'], dest: '<%= dir.js_app %>/vendor/backbone.js' },
                { src: ['bower_components/marionette/lib/backbone.marionette.js'], dest: '<%= dir.js_app %>/vendor/backbone.marionette.js' },
                { src: ['bower_components/jquery/dist/jquery.js'], dest: '<%= dir.js_app %>/vendor/jquery.js' },
                { src: ['bower_components/json2/json2.js'], dest: '<%= dir.js_app %>/vendor/json2.js' },
                { src: ['bower_components/lodash/dist/lodash.js'], dest: '<%= dir.js_app %>/vendor/lodash.js' },
                { src: ['bower_components/postal/lib/postal.js'], dest: '<%= dir.js_app %>/vendor/postal.js' },
                { src: ['bower_components/requirejs/require.js'], dest: '<%= dir.js_app %>/vendor/require.js' },
                { src: ['bower_components/requirejs-text/text.js'], dest: '<%= dir.js_app %>/vendor/text.js' },
                { src: ['bower_components/requirejs-underscore-tpl/underscore-tpl.js'], dest: '<%= dir.js_app %>/vendor/underscore-tpl.js' },
                { src: ['bower_components/underscore/underscore.js'], dest: '<%= dir.js_app %>/vendor/underscore.js' }
            ]
        },
        js: {
            files: [{ expand: true, cwd: '<%= dir.js_dev %>/', src: ['**/*'], dest: '<%= dir.js_app %>/' }]
        }
    },

    browserSync: {
        bsFiles: {
            src: [ 'web/**/*.html', 'web/**/*.css', 'web/**/*.js' ]
        },
        options: {
            proxy: "dev.toyotamore.pl/app_dev.php/test/app",
            watchTask: true
        }
    },


    watch: {
        sass: {
            files: '<%= dir.sass %>/**/*.scss',
            tasks: ['sass'],
        },

        js: {
            files: '<%= dir.js_dev %>/**/*.js',
            tasks: ['newer:jshint', 'copy:js_vendor', 'copy:js'],
        },

        img: {
            files: '<%= dir.img_dev %>/**/*.{png,jpg,jpeg,gif,svg}',
            tasks: ['newer:imagemin']
        },

        grunt: {
            files: 'Gruntfile.js'
        }
    }
});


grunt.registerTask('minify', ['sass', 'autoprefixer', 'cssmin', 'usebanner:css', 'uglify:prod', 'usebanner:js']);
grunt.registerTask('default', ['browserSync', 'watch']);
}

有人知道可能导致这个问题的原因吗?

0 个答案:

没有答案