css-relative-url-loader
v1.0.4
Published
Loader for webpack, replace relative paths in css with root
Readme
css-relative-url-loader
Loader for webpack.
Replaces the relative paths in the css files in the path relative to the root directory of the application. The root parameter is required.
Usage
const root = '/projects/angular2/';
// wepback.config.js
...
{
test: /.less$/,
exclude: /node_modules/,
loader: ['raw-loader', 'less-loader', 'css-relative-url-loader?root=' + root]
}Example
components
|
| my-component
| |
| | assets
| | |
| | | my-image.jpg
| | |
| | css
| | |
| | | style.cssbackground: url('./../assets/my-image.jpg');
will be replace with -> background: url('components/my-component/assets/my-image.jpg');
