1.0.0 • Published 3 years ago

snowpack-plugin-content-replace v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

snowpack-plugin-content-replace

A plugin for snowpack that replaces strings in output files.

Setup

npm install --save-dev snowpack-plugin-content-replace
// snowpack.config.mjs
export default {
  plugins: [
    ['snowpack-plugin-content-replace',
      {
        'replacements': {
          'default.hbs': {
            // '{{asset "built/assets/css/screen.css"}}' will be replaced with '{{asset "css/screen.css"}}'
            '{{asset "built/assets/css/screen.css"}}': '{{asset "css/screen.css"}}',
            '{{asset "built/assets/js/index.js"}}' : '{{asset "built/assets/js/index.js"}}'
          }
        }
      }
    ],
  ],
};

Plugin Options

NameTypeDescription
replacementsobjectDefines the replacements the plugin should do. Keys are the filename, values is an object with the form pattern -> replacement. See above for an example.
1.0.0

3 years ago