Skip to content

Commit

Permalink
Faster webpack compile time
Browse files Browse the repository at this point in the history
When adding custom css into a separate file webpack does not have to
compile the whole tailwindcss again but only the changes in
application.scss
  • Loading branch information
Hodel Lukas, ENT-BPN-BAN-PDC-SWE-2 authored and Hodel Lukas, ENT-BPN-BAN-PDC-SWE-2 committed Feb 7, 2021
1 parent 38acbb0 commit da7b43e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 0 additions & 3 deletions lib/install/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
2 changes: 2 additions & 0 deletions lib/install/stylesheets/tailwindcss/after.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "tailwindcss/components";
@import "tailwindcss/utilities";
1 change: 1 addition & 0 deletions lib/install/stylesheets/tailwindcss/before.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "tailwindcss/base";
5 changes: 4 additions & 1 deletion lib/install/tailwindcss_with_webpacker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

say "Installing Tailwind CSS"
run "yarn add tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9"
insert_into_file "#{Webpacker.config.source_entry_path}/application.js", "\nimport \"stylesheets/application\"\n"
insert_into_file "#{Webpacker.config.source_entry_path}/application.js",
"\nimport \"stylesheets/tailwindcss/before\""\
"\nimport \"stylesheets/application\""\
"\nimport \"stylesheets/tailwindcss/after\"\n"

say "Configuring Tailwind CSS"
directory Pathname.new(__dir__).join("stylesheets"), Webpacker.config.source_path.join("stylesheets")
Expand Down

0 comments on commit da7b43e

Please sign in to comment.