Skip to content

Commit

Permalink
Fix asset pipeline with libsass
Browse files Browse the repository at this point in the history
Using a sass css compressor causes a scss file to be processed twice
(once to build, once to compress) which breaks the usage of "unquote"
to use CSS that has same function names as SCSS such as max.
  • Loading branch information
cdccollins committed Aug 13, 2020
1 parent 280afdb commit ce19f54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ class Application < Rails::Application
# Path within public/ where assets are compiled to
config.assets.prefix = "/assets/government-frontend"

# Using a sass css compressor causes a scss file to be processed twice
# (once to build, once to compress) which breaks the usage of "unquote"
# to use CSS that has same function names as SCSS such as max.
# https://github.com/alphagov/govuk-frontend/issues/1350
config.assets.css_compressor = nil

# allow overriding the asset host with an enironment variable, useful for
# when router is proxying to this app but asset proxying isn't set up.
config.asset_host = ENV["ASSET_HOST"]
Expand Down
4 changes: 4 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

# Rather than use a CSS compressor, use the SASS style to perform compression.
config.sass.style = :compressed
config.sass.line_comments = false

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'

Expand Down

0 comments on commit ce19f54

Please sign in to comment.