placeholder-brunch

Replace placeholders with brunch

Usage no npm install needed!

<script type="module">
  import placeholderBrunch from 'https://cdn.skypack.dev/placeholder-brunch';
</script>

README

Placeholder Brunch Plugin

This simple plugin allows easy text replacements.

Installation

npm install --save-dev placeholder-brunch

Configuration

var config = {
  plugins: {
    placeholder: [
      // replace config values in files
      {
        pattern: /\.(js|jsx)$/, 
        replace: {'__ENV__': process.env.ENV || 'dev'}
      },
      // hash a global vendor dependency to prevent collision
      {
        pattern: /\.js/,
        replace: {'require': 'require_SOME_HASH'}
      },
      // add !important to all of your styles except
      // where "no-important" is explicitly set
      {
        pattern: /\.css/,
        replace: {
          '!important;': ';', // remove all current importants
          ';': ' !important;', // add importants everywhere
          'no-important !important;': ';' // remove importants where no-important is set
        }
      }
    ]
  }
}