diff --git a/README.md b/README.md index 122ff1f7..748079f1 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,6 @@ The last step adds the purger compressor to `config/environments/production.rb`. You can do these things yourself, if you've changed the default setup. -Note: You should ensure to delete `app/assets/stylesheets/scaffolds.scss` that Rails adds after running a scaffold command, if you had run this generator before installing Tailwind CSS for Rails. This stylesheet will interfere with Tailwind's reset of base styles. This gem will turn off stylesheet generation for all future scaffold runs. - ## Purging in production diff --git a/lib/install/tailwindcss.rb b/lib/install/tailwindcss.rb index e3b77d38..47d28c6d 100644 --- a/lib/install/tailwindcss.rb +++ b/lib/install/tailwindcss.rb @@ -8,5 +8,8 @@ say %( Add <%= stylesheet_link_tag "inter-font" %> and <%= stylesheet_link_tag "tailwind" %> within the tag in your custom layout.) end +say "Removing scaffold styles" +remove_file Rails.root.join("app/assets/stylesheets/scaffolds.scss") + say "Turn on purging of unused css classes in production" gsub_file Rails.root.join("config/environments/production.rb"), /^\s+#?\s+config.assets.css_compressor =.*$/, %( config.assets.css_compressor = :purger)