From dea4c8328d1718ee109bb6cf38a741536bc8eb94 Mon Sep 17 00:00:00 2001 From: Sang Huynh Date: Fri, 12 May 2023 14:55:43 +0700 Subject: [PATCH] [#385] Minify CSS --- .template/variants/web/Procfile.dev.rb | 2 +- .template/variants/web/package.json.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.template/variants/web/Procfile.dev.rb b/.template/variants/web/Procfile.dev.rb index b72ad4ac..c617cbd0 100644 --- a/.template/variants/web/Procfile.dev.rb +++ b/.template/variants/web/Procfile.dev.rb @@ -3,7 +3,7 @@ append_to_file 'Procfile.dev' do <<~PROCFILE js: yarn build --watch - css: yarn build:css --watch + css: yarn build:css-dev --watch postcss: yarn build:postcss --watch PROCFILE end diff --git a/.template/variants/web/package.json.rb b/.template/variants/web/package.json.rb index 8754d306..8092c986 100644 --- a/.template/variants/web/package.json.rb +++ b/.template/variants/web/package.json.rb @@ -45,10 +45,17 @@ '--no-source-map', '--load-path=node_modules' ] +production_bundled_stylesheet_options = [ + '--style=compressed' +] run %(npm set-script build "node app/javascript/build.js") run %( npm set-script build:css \ + "sass #{source_stylesheet} #{bundled_stylesheet} #{bundled_stylesheet_options.merge(production_bundled_stylesheet_options).join(' ')}" +) +run %( + npm set-script build:css-dev \ "sass #{source_stylesheet} #{bundled_stylesheet} #{bundled_stylesheet_options.join(' ')}" ) run %(npm set-script postcss "postcss public/assets/*.css --dir public/assets --config ./")