Skip to content

Webpacker: Basic purging patterns #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

dixpac
Copy link
Contributor

@dixpac dixpac commented Feb 8, 2021

This PR configures Tailwind purging with basic rails app needs.
Developers can easily change this down the road, but this should serve
as a good starting point.


On bare-bones rails new (running this in development env):

Before
Screenshot 2021-02-08 at 14 48 41

After
Screenshot 2021-02-08 at 14 49 36

ps
In real-world app difference will be smaller, since there is less to purge :)

This PR configures Tailwind purging with basic rails app needs.
Developers can easily change this down the road, but this should serve
as a good starting point.
@dixpac
Copy link
Contributor Author

dixpac commented Feb 15, 2021

@dhh wdyt?

'./app/javascript/**/*.js',
],
},
darkMode: false, // or 'media' or 'class'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to this PR, but should this be updated to match https://github.com/rails/tailwindcss-rails/blob/main/tailwind.config.js#L4 ?

Comment on lines +6 to +7
'./**/*.html.erb',
'./app/helpers/**/*.rb',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'./**/*.html.erb',
'./app/helpers/**/*.rb',
'./app/views/**/*.*,
'./app/helpers/**/*.rb',

IMO this should match the compressor: https://github.com/rails/tailwindcss-rails/blob/main/lib/tailwindcss/compressor.rb#L14, so that either way you use this gem you get the same outcome.

@dhh dhh closed this Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants