Skip to content

Commit 6cdb6cd

Browse files
committed
Webpacker: Basic purging patterns
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.
1 parent 38acbb0 commit 6cdb6cd

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
// Purge unused TailwindCSS styles
3+
purge: {
4+
enabled: ["production"].includes(process.env.NODE_ENV),
5+
content: [
6+
'./**/*.html.erb',
7+
'./app/helpers/**/*.rb',
8+
'./app/javascript/**/*.js',
9+
],
10+
},
11+
darkMode: false, // or 'media' or 'class'
12+
theme: {
13+
extend: {},
14+
},
15+
variants: {
16+
extend: {},
17+
},
18+
plugins: [],
19+
}

lib/install/tailwindcss_with_webpacker.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
say "Configuring Tailwind CSS"
99
directory Pathname.new(__dir__).join("stylesheets"), Webpacker.config.source_path.join("stylesheets")
10-
Dir.chdir(WEBPACK_STYLESHEETS_PATH) { run "npx tailwindcss init" }
1110

1211
insert_into_file "postcss.config.js", "require('tailwindcss')(\"./app/javascript/stylesheets/tailwind.config.js\"),\n ",
1312
before: "require('postcss-import')"

0 commit comments

Comments
 (0)