1.0.2 • Published 5 years ago

webpack-loader-append-prepend v1.0.2

Weekly downloads
24
License
MIT
Repository
github
Last release
5 years ago

webpack-loader-append-prepend

Loader for Webpack 4 to append and prepend text to files

Install

$ npm install --save-dev webpack-loader-append-prepend
$ yarn add -D webpack-loader-append-prepend

Usage

module.exports = {
  module: {
    rules: [
      {
        test: /\.js$/, // Use any filename you need
        use: [
          {
            loader: "webpack-loader-append-prepend",
            options: {
              prepend: "This goes at the beginning of the file",
              append: "This goes at the end of the file",
            }
          },
        ]
      }
    ]
  }
};

Warning

  • This loader add a new line after the prepend text, and new line before the append text.
  • Input text is not sanitized so be careful not the break the output. E.g. if you prepend text to a .js file, add your own semicolons to prevent automatic semicolon insertion.

License

MIT