Skip to content

Simple webpack 2 loader for CSS post-processing with Rework.

License

Notifications You must be signed in to change notification settings

rimselis/simple-rework-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-rework-loader

Simple webpack 2 loader for CSS post-processing with Rework.

Installation

npm install --save-dev simple-rework-loader

Usage

Add to your webpack config file and use in module.rules.

const reworkLoader = require('simple-rework-loader');

Configuration

// Add plugins
const reworkPluginUrl = require('rework-plugin-url');

function changeImageUrls(url) {
    return url.replace(/^(\.\.\/)*images\//, '/assets/images/');
}

// Write rules
module.exports = {
    // <...>
    module: {
        rules: [
            {
                test: /\.css$/,
                use: [{
                    loader: reworkLoader,
                    options: {
                        plugins: [reworkPluginUrl(changeImageUrls)]
                    }
                }]
            }
        ]
    }
}

options.plugins accepts an array of functions or a function. Plugins are applied right to left.

License

MIT

About

Simple webpack 2 loader for CSS post-processing with Rework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published