简体   繁体   English

运行grunt插件grunt-contrib-cssmin时出错

[英]Error running grunt plugin grunt-contrib-cssmin

Grunt newbie here. 在这里咕new新手。 I'm receiving the following error when I run the grunt task grunt-contrib-cssmin. 运行grunt任务grunt-contrib-cssmin时收到以下错误。 The modernizr task seems to be working: modernizr任务似乎正在起作用:

Running "cssmin:target" (cssmin) task
Warning: pattern.indexOf is not a function Use --force to continue.

Here is my gruntfile.js 这是我的gruntfile.js

module.exports = function(grunt) {
    grunt.initConfig ({
    // Do grunt-related things in here
        pkg: grunt.file.readJSON('package.json'),

        modernizr_builder: {
            build: {
                options: {
                    features: 'pointerevents',
                    dest: 'javascripts/modernizr-custom.js'
                }
            }
        },

        cssmin: {
          /*options: {
            shorthandCompacting: false,
            roundingPrecision: -1
          },*/
          target: {
            files: {
                files: {
                    'css/min/bigvideo.min.css': ['css/bigvideo.css']
                }
            }
          }
        },              
    });
    grunt.loadNpmTasks('grunt-modernizr-builder');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.registerTask('default',['modernizr_builder', 'cssmin']);
};

Here is my package.json file, I have the grunt-contrib-css installed in the project directory 这是我的package.json文件,我在项目目录中安装了grunt-contrib-css

{
  "name": "bootstrap-wp-less",
  "version": "1.0.0",
  "description": "No desc",
  "main": "index.js",
  "scripts": {
    "test": "test"
  },
  "author": "Me",
  "license": "ISC",
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-contrib-cssmin": "^0.14.0",
    "grunt-modernizr-builder": "^0.1.7"
  }
}

My error was in the cssmin task, changed to: 我的错误是在cssmin任务中,更改为:

cssmin: {
          /*options: {
            shorthandCompacting: false,
            roundingPrecision: -1
          },*/
          target: {
            files: {
                'css/min/bigvideo.min.css': ['css/bigvideo.css']
            }
          }
        },  

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

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