1
- LATEST_WEBPACKER = "\" @rails\/ webpacker\" : \" rails\/ webpacker#b6c2180\" ," . freeze
2
- TAILWIND_IMPORTS = "@import \" tailwindcss/base\" ;\n @import \" tailwindcss/components\" ;\n @import \" tailwindcss/utilities\" ;\n " . freeze
3
-
4
- say "Installing Tailwind CSS"
1
+ LATEST_WEBPACKER = "\" @rails\/ webpacker\" : \" rails\/ webpacker#b6c2180\" ,"
2
+ WEBPACK_STYLESHEETS_PATH = "#{ Webpacker . config . source_path } /stylesheets"
5
3
6
4
# Current webpacker version relies on an older version of PostCSS
7
5
# which the latest TailwindCSS version is not compatible with
8
- gsub_file ( ' package.json' , /\" @rails\/ webpacker\" .*/ ) { |matched_line | matched_line = LATEST_WEBPACKER }
6
+ gsub_file ( " package.json" , /\" @rails\/ webpacker\" .*/ ) { |matched_line | matched_line = LATEST_WEBPACKER }
9
7
10
- say "Adding latest tailwind and postcss "
8
+ say "Adding latest Tailwind CSS and postCSS "
11
9
run "yarn add tailwindcss@latest postcss@latest autoprefixer@latest"
12
- insert_into_file "#{ Webpacker . config . source_entry_path } /application.js" ,
13
- "\n require(\" stylesheets/application.scss\" )\n "
14
-
15
- say "Adding minimal configuration for TailwindCSS to work properly"
16
- stylesheets_directory = "#{ Webpacker . config . source_path } /stylesheets"
17
- empty_directory stylesheets_directory
18
- add_file "#{ stylesheets_directory } /application.scss"
19
- insert_into_file "#{ stylesheets_directory } /application.scss" , TAILWIND_IMPORTS
10
+ insert_into_file "#{ Webpacker . config . source_entry_path } /application.js" , "\n require(\" stylesheets/application.scss\" )\n "
20
11
21
- insert_into_file "postcss.config.js" ,
22
- "require('tailwindcss'), \n \t ", before : "require('postcss-import')"
12
+ say "Adding minimal configuration for Tailwind CSS to work properly"
13
+ directory "stylesheets/application.scss ", Webpacker . config . source_path
23
14
24
- say "Tailwind CSS successfully installed️" , :green
15
+ insert_into_file "postcss.config.js" , "require('tailwindcss'), \n \t " , before : "require('postcss-import')"
0 commit comments