Skip to content

Commit 4c84a26

Browse files
author
David Heinemeier Hansson
committed
Add the stylesheet pack tag
1 parent 234d97b commit 4c84a26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/install/tailwindcss_with_webpacker.rb

+8
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,11 @@
1414
directory Pathname.new(__dir__).join("stylesheets"), Webpacker.config.source_path.join("stylesheets")
1515

1616
insert_into_file "postcss.config.js", "require('tailwindcss'),\n\t", before: "require('postcss-import')"
17+
18+
if APPLICATION_LAYOUT_PATH.exist?
19+
say "Add Tailwindcss include tags in application layout"
20+
insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s, %(\n <%= stylesheet_pack_tag "application", "data-turbo-track": "reload" %>), before: /\s*<\/head>/
21+
else
22+
say "Default application.html.erb is missing!", :red
23+
say %( Add <%= stylesheet_pack_tag "application", "data-turbo-track": "reload" %> within the <head> tag in your custom layout.)
24+
end

0 commit comments

Comments
 (0)