# res-url-loader

> Webpack 环境下的静态资源文件加载器。 得益于 [file-loader]()的构建思路，允许被引用文件base64进引用文件内，保留 webpack publicPath 生成逻辑，同时解决 url-loader 显式指定[path]和[context]无法正确解析引用文件和被引用文件相对位置关系问题。

Latest version **1.1.4** (published 2017-12-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install res-url-loader
pnpm add res-url-loader
yarn add res-url-loader
bun add res-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.1.4 |
| Published | 2017-12-31 |
| First published | 2017-12-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | kernelj@gmail.com |
| Maintainers | kernelj |
| Keywords | url-loader |

## Links

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

## Dependencies (2)

- [mime](https://npm.io/package/mime.md) 1.2.x
- [loader-utils](https://npm.io/package/loader-utils.md) ~0.2.5

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.1.4 (latest) — 2017-12-31

## README

# Resource url loader for webpack

Webpack 环境下的静态资源文件加载器。
得益于 [file-loader]()的构建思路，允许被引用文件base64进引用文件内，保留 webpack publicPath 生成逻辑，同时解决 url-loader 显式指定[path]和[context]无法正确解析引用文件和被引用文件相对位置关系问题。

## Usage  
#### 安装  

```
	$ npm install resource-url-loader --save	
```

#### API
- `invokerRoot` 必选参数，表示调用该资源文件的样式表所在目录。要求为绝对路径。
- `limit` 可选，单位byte，表示base64与否的阈值，大于该 limit 值的文件将被保留原始物理文件参与构建，小于该值的文件将被 base64编码压进引用文件源码中。
- `publicPath` 可选，表示生产环境下的域名路径，若不指定，则从 webpack.output.publicPath继承。
- `outputPath` 可选，表示文件的复制目录。

```
{
	test: /\.(png|jpe?g|gif|svg)(\?\S*)?$/,
	loader: 'resource-url-loader',
	query: {
		limit : 1,
		invokerRoot : path.resolve(process.cwd(), "src/css"),
		publicPath : ''
	}
}
```




## License

MIT (http://www.opensource.org/licenses/mit-license.php)


[file-loader]:https://github.com/webpack/file-loader
[url-loader]:https://github.com/webpack/url-loader

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