# css-url-rewriter

> Looks for `url(...)` definitions in CSS and rewrites them

Latest version **0.1.3** (published 2015-10-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install css-url-rewriter
pnpm add css-url-rewriter
yarn add css-url-rewriter
bun add css-url-rewriter
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2015-10-17 |
| First published | 2014-01-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Callum Locke |
| Maintainers | callumlocke |

## Links

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

## Dependencies (1)

- [extend](https://npm.io/package/extend.md) ^3.0.0

## Recent versions

- 0.1.3 (latest) — 2015-10-17
- 0.1.2 — 2015-10-17
- 0.1.1 — 2015-10-17
- 0.1.0 — 2014-07-01
- 0.0.2 — 2014-04-15
- 0.0.1 — 2014-01-21

## README

# css-url-rewriter [![Build Status](https://secure.travis-ci.org/callumlocke/css-url-rewriter.svg?branch=master)](http://travis-ci.org/callumlocke/css-url-rewriter)

[![NPM](https://nodei.co/npm/css-url-rewriter.svg?downloads=true&stars=true)](https://nodei.co/npm/css-url-rewriter/)

Simple function that looks for `url(...)` definitions in a string of CSS and runs them through your own rewriter function.


## Getting Started
Install the module with: `npm install css-url-rewriter`

```js
var rewriteCSSURLs = require('css-url-rewriter');

// example - add a query string to all URLs
var newCSS = rewriteCSSURLs(someCSS, function (url) {
  return url + '?12345';
});
```

It will process all URLs it encounters by default, even `data:` URIs, so you need to check for those manually if you want to handle them differently. The only exception is URLs in 'excluded properties' (see settings).


### Settings
You can optionally pass in a settings object as a second argument:

```js
var newCSS = rewriteCSSURLs(someCSS, settings, function (url) {
  return url + '?12345';
});
```

Currently there is only one configurable setting, `excludedProperties`, which is an array of properties that you want to skip. This setting defaults to `['behavior', '*behavior']` (because you usually don't want to mess with URLs in this proprietary MSIE property, because it has weird relativity rules).


## License
Copyright (c) 2014 Callum Locke. Licensed under the MIT license.

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