# css-resources

> Find all image and font resources in css.

Latest version **0.2.0** (published 2015-07-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install css-resources
pnpm add css-resources
yarn add css-resources
bun add css-resources
```

## 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.2.0 |
| Published | 2015-07-01 |
| First published | 2015-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | chencheng |
| Maintainers | sorrycc |

## Links

- npm: https://www.npmjs.com/package/css-resources
- Repository: https://github.com/sorrycc/css-resources
- Issues: https://github.com/sorrycc/css-resources/issues
- npm.io page: https://npm.io/package/css-resources

## Dependencies (1)

- [css](https://npm.io/package/css.md) ~2.2.0

## Recent versions

- 0.2.0 (latest) — 2015-07-01
- 0.1.2 — 2015-04-10
- 0.1.1 — 2015-01-30
- 0.1.0 — 2015-01-28

## README

# css-resources

[![NPM version](https://img.shields.io/npm/v/css-resources.svg?style=flat)](https://npmjs.org/package/css-resources)
[![Build Status](https://img.shields.io/travis/sorrycc/css-resources.svg?style=flat)](https://travis-ci.org/sorrycc/css-resources)
[![Coverage Status](https://img.shields.io/coveralls/sorrycc/css-resources.svg?style=flat)](https://coveralls.io/r/sorrycc/css-resources)
[![NPM downloads](http://img.shields.io/npm/dm/css-resources.svg?style=flat)](https://npmjs.org/package/css-resources)

Find and replace all *image* and *font* resources in css.

---

## Install

```bash
$ npm install css-resources -g
```

## Usage

CSS file a.css

```
body {
  background: url(./a.png);
}
@font-face {
  src: url('./font.eot');
}
```

Parse CSS with resource

```bash
var resources = require('css-resources');
resources(fs.readFileSync('a.css'));
```

Return

```
[
  {
    property: 'background',
    string: 'url(./a.png)',
    path: './a.png'
  },
  {
    property: 'src',
    string: 'url(\'./font.eot\')',
    path: './font.eot'
  }
]
```

You can add a callback to replace css file

```
resources(fs.readFileSync('a.css'), function(item) {
  return 'url("' + resolve(item.path) + '");';
});
```


## LISENCE

Copyright (c) 2015 chencheng. Licensed under the MIT license.

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