Skip to content

Commit 68499d2

Browse files
authored
chore: don't add main in existing projects (#146)
1 parent 4dddc6b commit 68499d2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: lib/install/tailwindcss.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
88
ERB
99

10-
insert_into_file APPLICATION_LAYOUT_PATH.to_s, %( <main class="container mx-auto mt-28 px-5 flex">\n ), before: CENTERING_CONTAINER_INSERTION_POINT
11-
insert_into_file APPLICATION_LAYOUT_PATH.to_s, %(\n </main>), after: CENTERING_CONTAINER_INSERTION_POINT
10+
if File.open(APPLICATION_LAYOUT_PATH).read =~ /<body>\n\s*<%= yield %>\n\s*<\/body>/
11+
insert_into_file APPLICATION_LAYOUT_PATH.to_s, %( <main class="container mx-auto mt-28 px-5 flex">\n ), before: CENTERING_CONTAINER_INSERTION_POINT
12+
insert_into_file APPLICATION_LAYOUT_PATH.to_s, %(\n </main>), after: CENTERING_CONTAINER_INSERTION_POINT
13+
end
1214
else
1315
say "Default application.html.erb is missing!", :red
1416
say %( Add <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %> within the <head> tag in your custom layout.)

0 commit comments

Comments
 (0)