# imageinliner

> Tool for inlining images into css files

Latest version **0.2.4** (published 2015-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install imageinliner
pnpm add imageinliner
yarn add imageinliner
bun add imageinliner
```

Provides the command `imageinliner`.

## 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.4 |
| Published | 2015-11-19 |
| First published | 2013-12-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Kent Andersen |
| Maintainers | kentandersen |

## Links

- npm: https://www.npmjs.com/package/imageinliner
- Repository: https://github.com/kentandersen/imageinliner
- Issues: https://github.com/kentandersen/imageinliner/issues
- npm.io page: https://npm.io/package/imageinliner

## Dependencies (5)

- [mime](https://npm.io/package/mime.md) ~1.2.9
- [mkdirp](https://npm.io/package/mkdirp.md) ~0.3.5
- [optimist](https://npm.io/package/optimist.md) ~0.6.0
- [css-parse](https://npm.io/package/css-parse.md) ~1.7.0
- [css-stringify](https://npm.io/package/css-stringify.md) ~1.4.1

## Recent versions

- 0.2.4 (latest) — 2015-11-19
- 0.2.3 — 2014-09-27
- 0.2.2 — 2014-03-27
- 0.2.1 — 2014-02-03
- 0.2.0 — 2014-02-01
- 0.1.3 — 2014-01-09
- 0.1.2 — 2013-12-28
- 0.1.1 — 2013-12-25
- 0.1.0 — 2013-12-23

## README

## imageinliner

[![Build Status](https://api.travis-ci.org/kentandersen/imageinliner.png)](https://travis-ci.org/kentandersen/imageinliner)

```bash
npm install -g imageinliner
```

Tool for inlining background data-uri's into css files.


```bash
imageinliner -i style.css -o outputStyle.css
```

To overwrite the input file instead of outputting to a separate file, add the `--overwrite` flag.

```bash
imageinliner -i style.css --overwrite
```

When referring to images using source root (/some/images) the imageinliner need to know from where to calculate the root path. Use the `--rootPath` parameter.

```bash
imageinliner -i style.css -o outputStyle.css --rootPath /some/images
```

imageinliner will reformat the css (line breaks and indentations). To preserve compression and output all in one line, pass the `--compress` flag.

```bash
imageinliner -i style.css -o outputStyle.css --compress
```

Base64 images is somewhat larger than size of image by itself. Inlining files above 10k is not recommended. Best performance can be achieved for smaller files, where the http setup accounts for a large portion of the transfer. 

Pass a limiter (in byte) using the `--sizeLimit` parameter to exclude images above the sizeLimit.

```bash
imageinliner -i style.css -o outputStyle.css --sizeLimit 10240
```

Multiple parameters can be combined
```bash
imageinliner -i style.css -o outputStyle.css --rootPath /some/images --sizeLimit 10240 --compress
```

The imageinliner module can also be used from node.

with file path
```javascript
var inliner = require("imageinliner");

var cssData = inliner.file("style.css", {
    maxImageFileSize:   10240,
    rootImagePath:      "some/directory",
    compressOutput:     true
});
```

with css string
```javascript
var inliner = require("imageinliner");

var cssData = inliner.css(css, {
    maxImageFileSize:   10240,
    cssBasePath:        "some/directory/css"
    rootImagePath:      "some/directory",
    compressOutput:     true
});
```


---

## License

The MIT License (MIT)

Copyright (c) 2014 Kent Andersen &lt;kentareandersen@gmail.com&gt;

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

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