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!

Chords
  • 6,720
  • 2
  • 39
  • 61
  • Maybe cssmin has problems with your CSS. Maybe one of your npm packages is corrupt. I'd `rm -rf ./node_modules` and `npm install` to be sure. – hgoebl Dec 17 '13 at 20:24
  • @hgoebl I rm'd the specific package (thanks, wasn't sure how to do that) and re-installed with no luck. I did manage to combine and compress two specific files, so there must be something going on with a specific line of CSS somewhere. – Chords Dec 18 '13 at 14:44

1 Answers1

4

I removed CSS files until I found which was causing the problem. Everything is working again, so the issue actually came down to a CSS issue rather than Javascript.

Hope this helps someone else down the road.

Chords
  • 6,720
  • 2
  • 39
  • 61
  • 1
    Yes. This helped me. I had a .css file with a stray double-quote after a statement. Removed that, and cssmin worked again! – Andrew Ensley Sep 03 '14 at 20:18