@shoutem/webpack-prepend-append

Simple loader to append/prepend text to files (useful for adding file headers)

Usage no npm install needed!

<script type="module">
  import shoutemWebpackPrependAppend from 'https://cdn.skypack.dev/@shoutem/webpack-prepend-append';
</script>

README

Webpack loader to prepend/append text to files

Prepend/append text to the contents loaded by the loader. Useful to add headers, footers or to wrap all your files in the webpack pipeline.

Install:

$ npm install --save-dev @shoutem/webpack-prepend-append

Usage:

Add the loader to your webpack.config.js:

module.exports = {
    // ...
    module: {
      loaders: [
        // ...
        {
          test: /\.js$/,
          loader: '@shoutem/webpack-prepend-append',
          query: {
            prepend: 'Header text',
            append; 'Footer text'
          }
        }
      ]
    }
}
module.exports = {
    // ...
    module: {
      loaders: [
        // ...
        {
          test: /\.js$/,
          loader: '@shoutem/webpack-prepend-append',
          query: {
            prepend: 'WrapItIntoBlock {',
            append; '}'
          }
        }
      ]
    }
}

Licence:

MIT