nDmitry / grunt-autoprefixer

Parse CSS and add vendor-prefixed CSS properties using the Can I Use database. Based on Autoprefixer.
MIT License
795 stars 60 forks source link

Cannot call method 'slice' of undefined #8

Closed jpeterson closed 11 years ago

jpeterson commented 11 years ago

I'm getting this output as a warning when running grunt. It's accompanied by a deprecation notice:

Running "autoprefixer:dist" (autoprefixer) task
Method autoprefixer.compile is deprecated and will be removed in 0.7 version. 
Use autoprefixer(reqs).compile instead.
Warning: Cannot call method 'slice' of undefined Used --force, continuing.

I'm not sure how to fix this. Here is the autoprefixer task in my Gruntfile:

autoprefixer: {
    dist: {
        options: {
            browsers: ['last 1 version']
        },
        files: [{
            expand: true,
            cwd: '.tmp/styles/',
            src: '{,*/}*.css',
            dest: '.tmp/styles/'
        }]
    }
},
nDmitry commented 11 years ago

Seems like you have new version of Autoprefixer (with new API), but the old one (0.1.x) of grunt-autoprefixer. Just upgrade the plugin.

jpeterson commented 11 years ago

Thanks for the quick response @nDmitry ... You were correct that I had the old version of grunt-autoprefixer. I've updated that and it gets rid of the deprecation warning... but I'm still getting the other one:

Running "autoprefixer:dist" (autoprefixer) task
Warning: Cannot call method 'slice' of undefined Use --force to continue.
nDmitry commented 11 years ago

Are you sure that your CSS is correct? Can you paste it somewhere? I'd try to reproduce the error.

jpeterson commented 11 years ago

The Sass file is here: https://github.com/jpeterson/yeoman-sandbox/blob/master/app/styles/main.scss

In fact, cloning that repo and following the instruction in the README will reproduce the error

nDmitry commented 11 years ago

I can't reproduce the error with your settings and file structure both on node 0.10 & 0.8, sorry. This the prefixed output: http://pastebin.com/7GAm4SXV

jpeterson commented 11 years ago

Thanks for taking a look... I'll continue troubleshooting and update here if I uncover the issue.