From 19731626d2aff732521ad1965d604222cb30d1bc Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 19 Feb 2022 10:44:28 +0100 Subject: [PATCH] Ensure builds are added and stylesheets removed under Sprockets --- lib/install/dartsass.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/install/dartsass.rb b/lib/install/dartsass.rb index a9d5341..373288f 100644 --- a/lib/install/dartsass.rb +++ b/lib/install/dartsass.rb @@ -5,6 +5,13 @@ empty_directory "app/assets/builds" keep_file "app/assets/builds" +if (sprockets_manifest_path = Rails.root.join("app/assets/config/manifest.js")).exist? + append_to_file sprockets_manifest_path, %(//= link_tree ../builds\n) + + say "Stop linking stylesheets automatically" + gsub_file "app/assets/config/manifest.js", "//= link_directory ../stylesheets .css\n", "" +end + if Rails.root.join(".gitignore").exist? append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n)) end