# css-relative-url-loader

> Loader for webpack, replace relative paths in css with root

Latest version **1.0.4** (published 2016-10-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install css-relative-url-loader
pnpm add css-relative-url-loader
yarn add css-relative-url-loader
bun add css-relative-url-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2016-10-26 |
| First published | 2016-10-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alexandr Kazachenko |
| Maintainers | shoom3301 |

## Links

- npm: https://www.npmjs.com/package/css-relative-url-loader
- Repository: https://github.com/shoom3301/css-relative-url-loader
- Homepage: https://github.com/shoom3301/css-relative-url-loader#readme
- Issues: https://github.com/shoom3301/css-relative-url-loader/issues
- npm.io page: https://npm.io/package/css-relative-url-loader

## Dependencies (1)

- [loader-utils](https://npm.io/package/loader-utils.md) 0.2.16

## Recent versions

- 1.0.4 (latest) — 2016-10-26
- 1.0.3 — 2016-10-21
- 1.0.2 — 2016-10-20
- 1.0.1 — 2016-10-20
- 1.0.0 — 2016-10-20

## 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.css
```
 
`background: url('./../assets/my-image.jpg');`

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

---
_Source: https://npm.io/package/css-relative-url-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
