diff --git a/README.md b/README.md index c615c7b3..37f54a90 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ This gem just gives access to the standard Tailwind CSS framework. If you need t 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 `stylesheet_link_tag "tailwind"` to your `app/views/application.html.erb` file. +However, re-compiling assets does not currently work as expected because of caching in Sprockets, so you'll need to call `assets:clobber` and `assets:precompile` on each deployment for now. + You can do both things yourself, if you've changed the default setup. If you need to customize what files are searched for class names, you need to replace the compressor line with something like: diff --git a/lib/tailwindcss/compressor.rb b/lib/tailwindcss/compressor.rb index 92222ecf..48db6af1 100644 --- a/lib/tailwindcss/compressor.rb +++ b/lib/tailwindcss/compressor.rb @@ -14,6 +14,9 @@ def initialize(options = {}) end def call(input) - { data: Tailwindcss::Purger.purge(input[:data], keeping_class_names_from_files: @options[:files_with_class_names]) } + { + data: Tailwindcss::Purger.purge(input[:data], keeping_class_names_from_files: @options[:files_with_class_names]), + dependencies: @options[:files_with_class_names].map { |f| "file-digest://#{f.to_path}" }.to_set + } end end