0

咕噜新手在这里。运行 grunt 任务 grunt-contrib-cssmin 时收到以下错误。modernizr 任务似乎正在发挥作用:

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

这是我的 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']);
};

这是我的 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"
  }
}
4

1 回答 1

0

我的错误在 cssmin 任务中,改为:

cssmin: {
          /*options: {
            shorthandCompacting: false,
            roundingPrecision: -1
          },*/
          target: {
            files: {
                'css/min/bigvideo.min.css': ['css/bigvideo.css']
            }
          }
        },  
于 2016-01-03T21:03:22.933 回答