Fix SassC::SyntaxError when compiling perfectly valid CSS files

Okay cool, so this was an error that was happening *only* when building
assets for production: Sass's CSS minifier isn't familiar with all
modern CSS syntax (I think is the issue?), and so errors on things that
are actually totally okay.

I had previously worked around this in `swf_assets/show.css` with an
equivalent syntax that Sass recognized. But in this latest case with
the new `fonts.css.erb`, it was upset about the `src` list for the
fonts, and I don't know a workaround for that.

So, let's just disable Sass's CSS minification for now. I imagine the
difference isn't huge when CSS compresses just fine with gzip anyway?
(Most of what you can "minify" in CSS is whitespace, and that largely
seems silly to me when gzip is running.)
This commit is contained in:
Emi Matchu 2024-09-09 19:59:43 -07:00
parent 2466e5971e
commit 874483eacb
2 changed files with 3 additions and 5 deletions

View file

@ -4,9 +4,6 @@
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
width: min(100vw, 100vh);
/* HACK: `calc` isn't needed, but works around a bug in our asset pipeline, height: min(100vw, 100vh);
* where libsass is trying to preprocess it. (We're not SASS tho?) */
width: calc(min(100vw, 100vh));
height: calc(min(100vw, 100vh));
} }

View file

@ -58,6 +58,7 @@ module OpenneoImpressItems
config.assets.paths << Rails.root.join('app', 'assets', 'fonts') config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
config.assets.precompile << '*.js' config.assets.precompile << '*.js'
config.assets.initialize_on_precompile = false config.assets.initialize_on_precompile = false
config.assets.css_compressor = nil # Sass's compressor can't handle all modern CSS…
config.middleware.insert_after ActionDispatch::Flash, Rack::Attack config.middleware.insert_after ActionDispatch::Flash, Rack::Attack