咕噜:cssmin没工作

时间:2016-06-13 07:09:41

标签: gruntjs grunt-contrib-cssmin

我正在尝试使用Grunt cssmin插件缩小CSS。以下是我的代码:

var filteredProjects8 = finalbetfile2
    .Where(p => rank3of1.Intersect(p.BetInfo).Count() >= 5);

当我跑步" grunt cssmin"它给出了错误的#34;意外的标识符"。

2 个答案:

答案 0 :(得分:2)

您在监视任务中的js对象之后缺少逗号,以后您可以编辑您的答案以提供更多信息,而不是将其作为答案发布:)

        // Watch Tasks
        watch: {
            js: {
                files: ['wp/js/*.js'],
                tasks: ['uglify:dev']
            }, <------- Missing comma

            css: {
                files: ['wp/css/*.css'],
                tasks: ['']
            }
        }
    });

答案 1 :(得分:0)

@mike

`module.exports = function(grunt){

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

    // Uglify JS
    uglify: {
        build: {
            src: 'wp/js/*.js',
            dest: 'htt/js/script.min.js'
        },

        dev: {
            options: {
                beautify: true,
                mangel: false,
                compress: false,
                preserveComments: 'all'
            },
            src: 'wp/js/*.js',
            dest: 'htt/js/script.min.js'
        }
    },

    // Concatenating files
    concat: {
        build: {
            src: ['wp/css/*.css'],
            dest: 'htt/css/style.css'
        }
    },

    // Minify CSS
    cssmin: {
        build: {
            //options: {
            //  banner: '/* Minified CSS */'
            //},

            files: {
                'htt/css/style.min.css' : ['wp/css/**/*.css']
            }   
        }
    },

    // Watch Tasks
    watch: {
        js: {
            files: ['wp/js/*.js'],
            tasks: ['uglify:dev']
        }

        css: {
            files: ['wp/css/*.css'],
            tasks: ['']
        }
    }
});

// Load the Plugins
grunt.loadNpmTasks ('grunt-contrib-uglify');
grunt.loadNpmTasks ('grunt-contrib-watch');
grunt.loadNpmTasks ('grunt-contrib-concat');
grunt.loadNpmTasks ('grunt-contrib-cssmin');

// Register Tasks
grunt.registerTask ('default', ['uglify:dev']);
grunt.registerTask ('build', ['uglify:build', 'cssmin']);

};`

以上是整个gruntfile.js文件