Skip to content

Commit 067e42b

Browse files
committed
Generate stylesheet_link_tag on separate lines
Prior to this change, installing the engine via `bin/rails tailwindcss:install` yielded the following diff: ```diff --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,7 +6,9 @@ <%= csp_meta_tag %> - <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> + + <%= stylesheet_link_tag "inter-font", "data-turbo-track": "reload" %> + <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %> <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> <%= javascript_importmap_tags %> </head> ``` After this change, the calls to `stylesheet_link_tag` with `"inter-font"`, `"tailwind"`, and `"application"` all occur on their own lines.
1 parent 7a63d1a commit 067e42b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/install/tailwindcss.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
if APPLICATION_LAYOUT_PATH.exist?
44
say "Add Tailwindcss include tags in application layout"
5-
insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s, %(\n <%= stylesheet_link_tag "inter-font", "data-turbo-track": "reload" %>\n <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>), before: /^\s*<%= stylesheet_link_tag/
5+
insert_into_file APPLICATION_LAYOUT_PATH.to_s, <<~ERB.indent(4), before: /^\s*<%= stylesheet_link_tag/
6+
<%= stylesheet_link_tag "inter-font", "data-turbo-track": "reload" %>
7+
<%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
8+
ERB
69
else
710
say "Default application.html.erb is missing!", :red
811
say %( Add <%= stylesheet_link_tag "inter-font", "data-turbo-track": "reload" %> and <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %> within the <head> tag in your custom layout.)

0 commit comments

Comments
 (0)