2.0.0 • Published 8 years ago
text-transform-loader v2.0.0
Text Transform Loader
Webpack loader to prepend, append, or otherwise modify the text content of a module
You can use this for things like injecting headers or footers into your modules BEFORE any other
loaders do their processing. For example, say you want to prepend all of your .scss
files with
the same @import
function. You can do that!
This version supports webpack 2.x! If you try it and run into problems, check out the webpack 1.x release instead.
Installation
Via yarn:
yarn add --dev text-transform-loader
Via npm:
npm install --save-dev text-transform-loader
Configuration
Here are the things you can configure:
prependText
: adds text to the top of the moduleappendText
: adds text to the bottom of the moduletransformText
: transforms the module by running thecontent
and loaderoptions
through a custom function that returns the new content
Usage
Specify the loader and options in your webpack configuration:
{
// ...
module: {
rules: [
test: /\.s?css$/,
use: {
loader: 'text-transform-loader',
options: {
prependText: '@import \'your/stuff\';\n\n',
}
}
]
},
// ...
}