Grunt, TypeError: Object has no method 'Split'

1.2k views Asked by At

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!

1

There are 1 answers

1
Chords On BEST ANSWER

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.