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

sassc syntax error on RAILS_ENV=production bundle exec rake assets:precompile due to a specific line in my CSS #131

Open
alaarab opened this issue Aug 9, 2019 · 8 comments

Comments

@alaarab
Copy link

alaarab commented Aug 9, 2019

After attempting RAILS_ENV=production bundle exec rake assets:precompile, i get the following error

SassC::SyntaxError: Error: Invalid CSS after "...ia screen\\0 and": expected "{", was "(max-width: 1024px)"
        on line 18866 of stdin
>> @media screen\0 and (max-width: 1024px) {

It looks like this has to do with screen\0..? Not sure exactly why, but it seems like only sassc compiler is noticing this as invalid, however, it came straight from a reputable bootstrap theme, and has always worked before dropping in sassc-rails.

@bjgaynor
Copy link

bjgaynor commented Oct 9, 2019

It's taking issue with all of my CSS too, seems like the files aren't loading in the right order or something. Incredibly frustrating to see it throw me syntax errors with valid, working CSS.

@pandurang90
Copy link

@alaarab @bjgaynor were you able to fix this?

@Uysim
Copy link

Uysim commented Mar 27, 2020

Did anyone manage to resolve this?

@delacruzjames
Copy link

Did anyone manage to resolve this? UP!

@alaarab
Copy link
Author

alaarab commented Dec 16, 2020

@delacruzjames I do remember running into this issue when I was upgrading my rails app, but I don't remember what my solution was. I did not change my CSS at all, since the CSS belonged to a theme and I didn't want to do that. Looking back at my app, I see I commented out this gem completely from my Gemfile, and have gem "sass-rails", ">= 6" in my Gemfile, which is essentially currently supposed to just be a wrapper for this Gem, so I'm not sure what made this start working for me. It might have been some other change I made that truly resolved this.

@delacruzjames
Copy link

I already figured it out the issue. in rails 6 you have to pack everything in javacscript/packs/application.js so when you run rake assets:precompile there is no problem.

@Tashows
Copy link

Tashows commented Dec 17, 2020

I am getting a similar error as well:

** Execute assets:precompile
rake aborted!
SassC::SyntaxError: Error: 1.75rem/add isn't a valid CSS value.
        on line 2746 of stdin
>> e%3c/svg%3e") #fff no-repeat center right 1.75rem/add(0.75em, 0.375rem) add(
   ------------------------------------------^
stdin:2746

Having a very hard time trying to figure out what's causing this.

EDIT: Ok so for me, it was a really dumb inclusion of scss files in the wrong order, but even when I fixed that I was getting segmentation errors while precompiling. This issue helped me: #122

@wongwf82
Copy link

wongwf82 commented Nov 14, 2022

This answer on SO helped me:
https://stackoverflow.com/questions/70401077/rails-7-asset-pipeline-sasscsyntaxerror-with-tailwind/70665740#70665740

I put inside production.rb and deployment to Heroku was fine. However I've the gem "sassc-rails" commented out in my Gemfile though.

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

7 participants