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

Sass::SyntaxError: Invalid CSS when running tests #93

Open
jankeesvw opened this issue Jun 28, 2017 · 0 comments
Open

Sass::SyntaxError: Invalid CSS when running tests #93

jankeesvw opened this issue Jun 28, 2017 · 0 comments

Comments

@jankeesvw
Copy link

jankeesvw commented Jun 28, 2017

Hello, I'm doing a project where I use material_components_web-sass which requires me to use Sassc. I ran into a problem and after some digging I found an issue with sassc-rails's railtie. I found this code in railtie.rb:

initializer :setup_compression, group: :all do |app|
  if !Rails.env.development?
    app.config.assets.css_compressor = :sass unless app.config.assets.has_key?(:css_compressor)
  else
    # Use expanded output instead of the sass default of :nested unless specified
    app.config.sass.style ||= :expanded
  end
end

Turns out sassc-rails does something different in the !Rails.env.development? environments.

What I did to workaround this problem was to set a value in the css_compressor so it doest get overwritten.

So by adding this to my config/environments/test.rb the problems went away:

# Set a css_compressor so sassc-rails does not overwrite the compressor when running the tests
config.assets.css_compressor = nil

Is there a reason there is different behavior for non-development environments? Otherwise I would love to propose a pull request to change this code.

mec added a commit to DFE-Digital/claim-additional-payments-for-teaching that referenced this issue Aug 19, 2019
Since sass-rails 6 is a wrapper for sassc-rails we started to see this
issue:

sass/sassc-rails#93

setting config.assets.css_comporessor to nil allows the sass to be
compiled.
lozette pushed a commit to dxw/rails-template that referenced this issue Oct 25, 2019
…ets 4

While working on beis-report-overseas-development-assistance we encountered an
issue where the assets would not precompile in production when using govuk-frontend

After a lot of digging we found the following issue:

sass/sassc-rails#93

Which was used by @mec in dfe-teachers-payment-service:

DFE-Digital/claim-additional-payments-for-teaching@74ec587

To save everyone else the pain we suggest this is added to rails-template by
default!
tobyprivett added a commit to DEFRA/flood-risk-front-office that referenced this issue Jun 9, 2021
tobyprivett added a commit to DEFRA/flood-risk-front-office that referenced this issue Jun 10, 2021
tobyprivett added a commit to DEFRA/flood-risk-front-office that referenced this issue Jun 10, 2021
tobyprivett added a commit to DEFRA/flood-risk-front-office that referenced this issue Jun 17, 2021
AndrewVos added a commit to guidance-guarantee-programme/pension_guidance that referenced this issue Dec 1, 2021
seaki added a commit to seaki/rubicure-graphql that referenced this issue May 2, 2023
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

1 participant