Skip to content

shoom3301/css-relative-url-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

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.css

background: url('./../assets/my-image.jpg');

will be replace with -> background: url('components/my-component/assets/my-image.jpg');

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published