ARTICLE AD BOX
I have a non-Rails Ruby application that uses Sprockets and Sinatra. It currently processes SCSS using the sass and sprockets-sass gems, which have long been deprecated in favor of processing by dart-sass.
The nice thing sprockets-sass did was process .scss.erb files automatically, allowing for embedding data in CSS:
._hide-in-development { <%= App.environment != :production ? 'display: none;' : '' %> }I'm attempting but failing to achieve this behavior while using dart-sass. All advice (including even the dartsass-sprockets gem docs) usually involves configuring the Rails asset pipeline, which this app does not have.
I'm not married to dartsass-sprockets, or even the ERB template approach. Anything that allows injecting external data into SCSS is great.
Relevant block of the current Sinatra config:
set :root, Pathname.new(File.expand_path('../..', __FILE__)) set :sprockets, Sprockets::Environment.new(root) set :assets_prefix, 'assets' set :assets_path, File.join(public_folder, assets_prefix) set :assets_manifest_path, File.join(assets_path, 'manifest.json') set :assets_compile, %w(*.png docs.js docs.json application.js application.css application-dark.css)