From df002ef59e65c88bfa6bffd945243766d09cfa5b Mon Sep 17 00:00:00 2001 From: BakiVernes Date: Tue, 19 Jan 2021 12:08:21 +0100 Subject: [PATCH] Make webpack script more readable --- lib/install/stylesheets/application.scss | 3 +++ lib/install/tailwindcss_with_webpacker.rb | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 lib/install/stylesheets/application.scss diff --git a/lib/install/stylesheets/application.scss b/lib/install/stylesheets/application.scss new file mode 100644 index 00000000..76fcadcc --- /dev/null +++ b/lib/install/stylesheets/application.scss @@ -0,0 +1,3 @@ +@import "tailwindcss/base"; +@import "tailwindcss/components"; +@import "tailwindcss/utilities"; diff --git a/lib/install/tailwindcss_with_webpacker.rb b/lib/install/tailwindcss_with_webpacker.rb index 7b0ec8a3..fd6bf86d 100644 --- a/lib/install/tailwindcss_with_webpacker.rb +++ b/lib/install/tailwindcss_with_webpacker.rb @@ -1,5 +1,4 @@ LATEST_WEBPACKER = "\"@rails\/webpacker\": \"rails\/webpacker#b6c2180\",".freeze -TAILWIND_IMPORTS = "@import \"tailwindcss/base\";\n@import \"tailwindcss/components\";\n@import \"tailwindcss/utilities\";\n".freeze say "Installing Tailwind CSS" @@ -13,10 +12,7 @@ "\nrequire(\"stylesheets/application.scss\")\n" say "Adding minimal configuration for TailwindCSS to work properly" -stylesheets_directory = "#{Webpacker.config.source_path}/stylesheets" -empty_directory stylesheets_directory -add_file "#{stylesheets_directory}/application.scss" -insert_into_file "#{stylesheets_directory}/application.scss", TAILWIND_IMPORTS +directory "stylesheets/application.scss", Webpacker.config.source_path insert_into_file "postcss.config.js", "require('tailwindcss'),\n\t", before: "require('postcss-import')"