Skip to content

Loader for Webpack 4 to append and prepend text to files

License

Notifications You must be signed in to change notification settings

fedemp/webpack-loader-append-prepend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Loader for Webpack 4 to append and prepend text to files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published