From 6d64f8301482083942221f1f8f4b89ad6cadf71c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Pinz=C3=B3n?= <10928518+pinzonjulian@users.noreply.github.com> Date: Fri, 30 Jun 2023 23:09:38 +1000 Subject: [PATCH] Add PostCSS import plugin as default https://github.com/postcss/postcss-import It felt natural to me to immediately use the @import directive and after fighting a bit with it I relised the plugin wasn't installed so it seemed like it would be a sensible default to have. Adding the official postcss-import plugin enables the usage of PostCSS's @import directive out of the box so when adding a CSS library (like open-props) or when adding custom stylesheets it works seamlessly Note that this is **not** the CSS native @import. --- lib/install/postcss/install.rb | 2 +- lib/install/postcss/postcss.config.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/install/postcss/install.rb b/lib/install/postcss/install.rb index fbad140..18aa4e0 100644 --- a/lib/install/postcss/install.rb +++ b/lib/install/postcss/install.rb @@ -1,7 +1,7 @@ say "Install PostCSS w/ nesting and autoprefixer" copy_file "#{__dir__}/postcss.config.js", "postcss.config.js" copy_file "#{__dir__}/application.postcss.css", "app/assets/stylesheets/application.postcss.css" -run "yarn add postcss postcss-cli postcss-nesting autoprefixer" +run "yarn add postcss postcss-cli postcss-import postcss-nesting autoprefixer" say "Add build:css script" build_script = "postcss ./app/assets/stylesheets/application.postcss.css -o ./app/assets/builds/application.css" diff --git a/lib/install/postcss/postcss.config.js b/lib/install/postcss/postcss.config.js index aa18064..bc2a02e 100644 --- a/lib/install/postcss/postcss.config.js +++ b/lib/install/postcss/postcss.config.js @@ -1,5 +1,6 @@ module.exports = { plugins: [ + require('postcss-import'), require('postcss-nesting'), require('autoprefixer'), ],