Skip to content

Commit 076857e

Browse files
author
David Heinemeier Hansson
authored
Merge pull request #30 from dixpac/dix/fix_webpacker_install
FIX: Webpacker install
2 parents 63e6dbc + 28cec67 commit 076857e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/install/tailwindcss_with_webpacker.rb

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
LATEST_WEBPACKER = "\"@rails\/webpacker\": \"rails\/webpacker#b6c2180\","
21
WEBPACK_STYLESHEETS_PATH = "#{Webpacker.config.source_path}/stylesheets"
32
APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
43

5-
# Current webpacker version relies on an older version of PostCSS
6-
# which the latest TailwindCSS version is not compatible with
7-
gsub_file("package.json", /\"@rails\/webpacker\".*/) { |matched_line| matched_line = LATEST_WEBPACKER }
8-
9-
say "Adding latest Tailwind CSS and postCSS"
10-
run "yarn add tailwindcss@latest postcss@latest autoprefixer@latest"
11-
insert_into_file "#{Webpacker.config.source_entry_path}/application.js", "\nrequire(\"stylesheets/application.scss\")\n"
4+
say "Installing Tailwind CSS"
5+
run "yarn add tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9"
6+
insert_into_file "#{Webpacker.config.source_entry_path}/application.js", "\nimport \"stylesheets/application\"\n"
127

138
say "Adding minimal configuration for Tailwind CSS to work properly"
149
directory Pathname.new(__dir__).join("stylesheets"), Webpacker.config.source_path.join("stylesheets")

0 commit comments

Comments
 (0)