Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    simple-rework-loaderpublic

    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

    install

    npm i simple-rework-loader

    Downloadsweekly downloads

    8

    version

    0.1.3

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar