Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Cannot read property 'type' of undefined Use --force to continue. #4

Open
hughgrigg opened this issue Mar 22, 2014 · 9 comments

Comments

@hughgrigg
Copy link

Trying to run cssc as part of a css build process. Other items work fine but cssc is giving me this:

Running "cssc:build" (cssc) task
Warning: Cannot read property 'type' of undefined Use --force to continue.

I can't figure out where that error is coming from. Is it a path problem? A dependency? Something in the css?

Relevant part of gruntfile:

cssc: {
    build: {
        options: {
            consolidateViaDeclarations: true,
            sort: true
        },
        files: {
            'build/css/master.css': 'build/css/master.css'
        }
    }
}
@fini
Copy link

fini commented Mar 25, 2014

I am also experiencing this error with one of my two css files. I am not really sure where the problem is occuring or why.

@ghost
Copy link

ghost commented Apr 12, 2014

I also just came across the same error on my first test with a simple compass project. I worked out that is was the:

    debugInfo: true"

option set on the compass task which output the css file that cssc was trying to condense.
The debugInfo option causes compass to output the debug info as

    @media -sass-debug-info{ ... 

which I guess is what the cssc was choking on. Setting "debugInfo: false" got it working.

Not sure if that's exactly the reason you guys we getting the error, just thought I'd mention it in case anyone else get stuck on the same thing.

@erfanimani
Copy link

I'm getting the same error.. Setting the output style to compressed (which removes all the debug info mentioned above) doesn't work..

@ghost
Copy link

ghost commented Apr 14, 2014

Yeah I'm also getting the error when setting the cssc option:

compress: true

setting it to false works.
No idea why.

@yura-chaikovsky
Copy link

This is an issue in css-condense v0.0.6. It is already fixed in v0.1.1, so for quick fix you can update package.json for grunt-cssc with newer version.
And of course it will be greate if author uodate it in npm.

@patrickwelker
Copy link
Contributor

Until @mediapart fixes this, can you ( @yura-chaikovsky ) tell me how to update the peerDependencies for this sibling. I tried to separately install a newer version via "css-condense": "^0.1.1", but this doesn't work.

@AdelDima
Copy link

I use the last version but i ma still stuck in the some problem .

@patrickwelker
Copy link
Contributor

@AdelDima Currently this works for me:

    cssc: {
        build: {
            options: {
                debugInfo: true,
                sortSelectors: true,
                lineBreaks: true,
                sortDeclarations:true,
                consolidateViaDeclarations:true,
                consolidateViaSelectors:false,
                consolidateMediaQueries:true,
            },
            files: {
                '<%= assets_dist %>/main.css': '<%= assets_dist %>/main.css'
            }
        }
    },

Obviously using the selectors would be awesome.

I came across these two solutions:

… with the first being quite simple (and what I already tried + which failed) I had high hopes for the latter. Sadly npm shrinkwrap threw up some errors and I settled for the most basic patch. I forked the repo and updated the dependencies to use the latest css-condense version.

To try it out, first uninstall grunt-cssc, install css-condense, then add my fork to your packages file this way:

"grunt-cssc": "https://github.com/pattulus/grunt-cssc/archive/2.7.tar.gz",

That said, I get another error when using cssc:

Warning: Cannot call method 'map' of undefined Use --force to continue.

If you're willing to try it out, tell me how it went. For now and until I figured it out, I'm not sending out a pull request for this fork.

@AdelDima
Copy link

Thank you @pattulus it work for me now :) . first i get " [email protected] wants css-condense@~0.1.1" i was using 0.0.6 after update css-condense and add your cssc version all work perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants