diff --git a/bridgetown-core/lib/bridgetown-core/configurations/bt-postcss.rb b/bridgetown-core/lib/bridgetown-core/configurations/bt-postcss.rb index 035831029..5f21ad8f0 100644 --- a/bridgetown-core/lib/bridgetown-core/configurations/bt-postcss.rb +++ b/bridgetown-core/lib/bridgetown-core/configurations/bt-postcss.rb @@ -13,12 +13,14 @@ return end +confirm = ask "This configuration will ovewrite your existing #{"postcss.config.js".bold.white}. Would you like to continue? [Yn]" +return unless confirm.casecmp?("Y") + plugins = %w(postcss-easy-import postcss-mixins postcss-color-function cssnano) say "Adding the following PostCSS plugins: #{plugins.join(' | ')}", :green run "yarn add -D #{plugins.join(' ')}" -remove_file "postcss.config.js" -copy_file "#{TEMPLATE_PATH}/postcss.config.js", "postcss.config.js" +copy_file "#{TEMPLATE_PATH}/postcss.config.js", "postcss.config.js", force: true # rubocop:enable all diff --git a/bridgetown-core/lib/bridgetown-core/configurations/tailwindcss.rb b/bridgetown-core/lib/bridgetown-core/configurations/tailwindcss.rb index 77df059fe..cbb2c120d 100644 --- a/bridgetown-core/lib/bridgetown-core/configurations/tailwindcss.rb +++ b/bridgetown-core/lib/bridgetown-core/configurations/tailwindcss.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +# rubocop:disable all + TEMPLATE_PATH = File.expand_path("./tailwindcss", __dir__) unless File.exist?("postcss.config.js") @@ -11,13 +13,17 @@ return end +confirm = ask "This configuration will ovewrite your existing #{"postcss.config.js".bold.white}. Would you like to continue? [Yn]" +return unless confirm.casecmp?("Y") + run "yarn add -D tailwindcss" run "npx tailwindcss init" -remove_file "postcss.config.js" -copy_file "#{TEMPLATE_PATH}/postcss.config.js", "postcss.config.js" +copy_file "#{TEMPLATE_PATH}/postcss.config.js", "postcss.config.js", force: true prepend_to_file "frontend/styles/index.css", File.read("#{TEMPLATE_PATH}/css_imports.css") run "bundle exec bridgetown configure purgecss" + +# rubocop:enable all