From ce19f543c679323455d3d4a731642c5bd8790ee1 Mon Sep 17 00:00:00 2001 From: Celia Collins Date: Fri, 24 Jul 2020 17:18:38 +0100 Subject: [PATCH] Fix asset pipeline with libsass 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. --- config/application.rb | 6 ++++++ config/environments/production.rb | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/config/application.rb b/config/application.rb index 5aec70374..ac74f1238 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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"] diff --git a/config/environments/production.rb b/config/environments/production.rb index a6e3061b6..dc3bab9a2 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -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'