Sha256: d4836bf484bbad38b50757a4e07ca756fb57c92c0b7f358199d2b07a7b2fb02e

Contents?: true

Size: 881 Bytes

Versions: 13

Compression:

Stored size: 881 Bytes

Contents

# frozen_string_literal: true

# rubocop:disable all

TEMPLATE_PATH = File.expand_path("./bt-postcss", __dir__)

unless File.exist?("postcss.config.js")
  error_message = "#{"postcss.config.js".bold} not found. Please configure postcss in your project."

  @logger.error "\nError:".red, "🚨 #{error_message}"
  @logger.info "\nRun #{"bridgetown webpack enable-postcss".bold.blue} to set it up.\n"

  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(' ')}"

copy_file "#{TEMPLATE_PATH}/postcss.config.js", "postcss.config.js", force: true

# rubocop:enable all

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
bridgetown-core-1.0.0.alpha6 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-1.0.0.alpha5 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-0.21.5 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-1.0.0.alpha4 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-1.0.0.alpha3 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-1.0.0.alpha2 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-1.0.0.alpha1 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-0.21.4 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-0.21.3 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-0.21.2 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-0.21.1 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-0.21.0 lib/bridgetown-core/configurations/bt-postcss.rb
bridgetown-core-0.21.0.beta4 lib/bridgetown-core/configurations/bt-postcss.rb