Skip to content

Commit 07e7171

Browse files
author
David Heinemeier Hansson
committed
Fix install and instructions
1 parent 2366335 commit 07e7171

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ This gem just gives access to the standard Tailwind CSS framework. If you need t
1010
## Installation
1111

1212
1. Run `./bin/bundle add tailwindcss-rails`
13-
2. Run `./bin/rails tailwindcss:install`
13+
2. Run `./bin/rails tailwindcss:install` (on a fresh Rails application)
1414

15-
The last option adds the purger compressor to `config/environments/production.rb`. This ensures that when `assets:precompile` is called during deployment that the unused class names are not included in the tailwind output css used by the app. It also adds a `javascript_link_tag` to your `app/views/application.html.erb` file.
15+
The last option adds the purger compressor to `config/environments/production.rb`. This ensures that when `assets:precompile` is called during deployment that the unused class names are not included in the tailwind output css used by the app. It also adds a `javascript_link_tag "tailwind"` to your `app/views/application.html.erb` file.
16+
17+
You can do both things yourself, if you've changed the default setup.
1618

1719
If you need to customize what files are searched for class names, you need to replace the compressor line with something like:
1820

lib/install/tailwindcss.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
end
1010

1111
say "Turn on purging of unused css classes in production"
12-
append_to_file Rails.root.join("config/environments/production.rb"), %( config.assets.css_compressor = :purger)
12+
gsub_file Rails.root.join("config/environments/production.rb"), /^\s+#?\s+config.assets.css_compressor =.*$/, %( config.assets.css_compressor = :purger)

0 commit comments

Comments
 (0)