1.0.3 • Published 6 years ago

var-loader v1.0.3

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

var-loader

string variable replace loader for webpack

Installation

npm

$ npm install var-loader

or yarn

$ yarn add var-loader

Usage

// webpack.config.js
module.exports = {
	...
    module: {
        rules: [{
            test: /\.tpl$/,
            use: [
                'raw-loader',
                {
                    loader: 'var-loader',
                    options: {

                        // the string will to replaced as regexp
                        find: /\$\{(.*?)\}/g

                        // the replace function as a value to return
                        replace: (key, val) => ['prefix', key, val].join('-'),

                        // the replace variable map
                        data: {
                            name: 'value'
                        }
                    }
                }
            ]
        }]
    }
};
1.0.3

6 years ago

1.0.202

6 years ago

1.0.201

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago