3

I'm setting up Grunt for the first time and it has all been going smoothly (using Chris Coyier's 24 Ways article: http://24ways.org/2013/grunt-is-not-weird-and-hard/).

Go figure, I step off the beaten path and I'm running into issues. I installed cssmin to minify my already concatenated CSS, and I'm getting:

Running "cssmin:combine" (cssmin) task
>> TypeError: Object behavior:__ESCAPED_EXPRESSION_CLEAN_CSS0_ has no method 'split'
Warning: css minification failed. Use --force to continue.

Aborted due to warnings.

Using --force also fails (Warning: css minification failed.)

I was able to install, configure and use concat, uglify and imagemin without issues. Here is my simplified grunt file to try to isolate the issue:

module.exports = function(grunt) {

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

        cssmin: {
            combine: {
                files: {
                    'resources/css/build/site.prod.test.css': ['resources/css/libs/*.css', 'resources/css/*.css']
                }
            }
        }

grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default', ['cssmin']);

I've also tried using the specific examples from the documentation, but I get the same 'split' error regardless of which I try:

https://github.com/gruntjs/grunt-contrib-cssmin

Any help is appreciated!

4

1 回答 1

4

我删除了 CSS 文件,直到找到导致问题的原因。一切都恢复正常了,所以问题实际上归结为 CSS 问题而不是 Javascript。

希望这可以帮助其他人。

于 2014-01-06T14:36:10.787 回答