DEV: Remove dependence on dartsass-sprockets (#23665)

Discourse has a custom stylesheet pipeline which compiles things 'just in time'. The only place we were still running sass files through sprockets was for the `/tests` route in development mode. This use can be removed by compiling the relevant stylesheets through ember-cli instead (which we were already doing for testem runs)

This work was prompted by the incompatibility of dartsass-sprockets with the latest sass-embedded release (https://github.com/tablecheck/dartsass-sprockets/issues/13)
This commit is contained in:
David Taylor
2023-09-26 16:25:07 +01:00
committed by GitHub
parent 8958b4f76a
commit 110fdf0189
4 changed files with 22 additions and 26 deletions

View File

@ -181,6 +181,15 @@ module Discourse
charset: :unicode
Sprockets.register_postprocessor "application/javascript", DiscourseJsProcessor
class SprocketsSassUnsupported
def self.call(*args)
raise "Discourse does not support compiling scss/sass files via Sprockets"
end
end
Sprockets.register_engine(".sass", SprocketsSassUnsupported, silence_deprecation: true)
Sprockets.register_engine(".scss", SprocketsSassUnsupported, silence_deprecation: true)
Discourse::Application.initializer :prepend_ember_assets do |app|
# Needs to be in its own initializer so it runs after the append_assets_path initializer defined by Sprockets
app