🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

css-relative-url-loader

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-relative-url-loader

Loader for webpack, replace relative paths in css with root

1.0.4
latest
Source
npm
Version published
Weekly downloads
1
-87.5%
Maintainers
1
Weekly downloads
 
Created
Source

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');

FAQs

Package last updated on 26 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts