pax_global_header 0000666 0000000 0000000 00000000064 13117541025 0014511 g ustar 00root root 0000000 0000000 52 comment=5574ed3ec10c71440f6de32f0abcd5d2609ffb79
url-loader-0.5.9/ 0000775 0000000 0000000 00000000000 13117541025 0013572 5 ustar 00root root 0000000 0000000 url-loader-0.5.9/.github/ 0000775 0000000 0000000 00000000000 13117541025 0015132 5 ustar 00root root 0000000 0000000 url-loader-0.5.9/.github/ISSUE_TEMPLATE.md 0000664 0000000 0000000 00000001333 13117541025 0017637 0 ustar 00root root 0000000 0000000
**Do you want to request a *feature* or report a *bug*?**
**What is the current behavior?**
**If the current behavior is a bug, please provide the steps to reproduce.**
**What is the expected behavior?**
**If this is a feature request, what is motivation or use case for changing the behavior?**
**Please mention other relevant information such as your webpack version, Node.js version and Operating System.**
url-loader-0.5.9/.github/PULL_REQUEST_TEMPLATE.md 0000664 0000000 0000000 00000001314 13117541025 0020732 0 ustar 00root root 0000000 0000000
**What kind of change does this PR introduce?**
**Did you add tests for your changes?**
**If relevant, did you update the README?**
**Summary**
**Does this PR introduce a breaking change?**
**Other information**
url-loader-0.5.9/.gitignore 0000664 0000000 0000000 00000000014 13117541025 0015555 0 ustar 00root root 0000000 0000000 node_modules url-loader-0.5.9/CHANGELOG.md 0000664 0000000 0000000 00000001500 13117541025 0015377 0 ustar 00root root 0000000 0000000 # Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [0.5.9](https://github.com/webpack/url-loader/compare/v0.5.8...v0.5.9) (2017-06-12)
### Bug Fixes
* `String` not being `base64` encoded ([#67](https://github.com/webpack/url-loader/issues/67)) ([e9496b9](https://github.com/webpack/url-loader/commit/e9496b9))
* don't default to `0` (`options.limit`) ([#74](https://github.com/webpack/url-loader/issues/74)) ([020c2a8](https://github.com/webpack/url-loader/commit/020c2a8))
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
url-loader-0.5.9/LICENSE 0000664 0000000 0000000 00000002057 13117541025 0014603 0 ustar 00root root 0000000 0000000 Copyright JS Foundation and other contributors
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.
url-loader-0.5.9/README.md 0000664 0000000 0000000 00000010353 13117541025 0015053 0 ustar 00root root 0000000 0000000 [![npm][npm]][npm-url]
[![node][node]][node-url]
[![deps][deps]][deps-url]
[![tests][tests]][tests-url]
[![coverage][cover]][cover-url]
[![chat][chat]][chat-url]
URL Loader
Loads files as `base64` encoded URL
Install
```bash
npm install --save-dev url-loader
```
The `url-loader` works like the [`file-loader`](https://github.com/webpack-contrib/file-loader), but can return a DataURL if the file is smaller than a byte limit.
```js
import img from './image.png'
```
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.(png|jpg|gif)$/,
use: [
{
loader: 'url-loader'
options: {
limit: 8192
}
}
]
}
]
}
}
```
Options
|Name|Type|Default|Description|
|:--:|:--:|:-----:|:----------|
|**`limit`**|`{Number}`|`undefined`|Byte limit to inline files as Data URL|
|**`mimetype`**|`{String}`|`extname`|Specify MIME type for the file (Otherwise it's inferred from the file extension)|
|**`prefix`**|`{String}`|`false`|Parameters for the [`file-loader`](https://github.com/webpack-contrib/file-loader) are valid too. They are passed to the file-loader if used|
### `limit`
If the file is greater than the limit (in bytes) the [`file-loader`](https://github.com/webpack-contrib/file-loader) is used and all query parameters are passed to it.
The limit can be specified via loader options and defaults to no limit.
**webpack.config.js**
```js
{
loader: 'url-loader',
options: {
limit: 8192
}
}
```
### `mimetype`
Set the MIME type for the file. If unspecified the file extensions will be used to lookup the MIME type.
**webpack.config.js**
```js
{
loader: 'url-loader',
options: {
mimetype: 'image/png'
}
}
```
### `prefix`
```js
{
loader: 'url-loader',
options: {
prefix: 'img'
}
}
```
Maintainers
[npm]: https://img.shields.io/npm/v/url-loader.svg
[npm-url]: https://npmjs.com/package/url-loader
[node]: https://img.shields.io/node/v/url-loader.svg
[node-url]: https://nodejs.org
[deps]: https://david-dm.org/webpack-contrib/url-loader.svg
[deps-url]: https://david-dm.org/webpack-contrib/url-loader
[tests]: http://img.shields.io/travis/webpack-contrib/url-loader.svg
[tests-url]: https://travis-ci.org/webpack-contrib/url-loader
[cover]: https://coveralls.io/repos/github/webpack-contrib/url-loader/badge.svg
[cover-url]: https://coveralls.io/github/webpack-contrib/url-loader
[chat]: https://badges.gitter.im/webpack/webpack.svg
[chat-url]: https://gitter.im/webpack/webpack
url-loader-0.5.9/index.js 0000664 0000000 0000000 00000002111 13117541025 0015232 0 ustar 00root root 0000000 0000000 /*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var loaderUtils = require("loader-utils");
var mime = require("mime");
module.exports = function(content) {
this.cacheable && this.cacheable();
var options = loaderUtils.getOptions(this) || {};
// Options `dataUrlLimit` is backward compatibility with first loader versions
var limit = options.limit || (this.options && this.options.url && this.options.url.dataUrlLimit);
if(limit) {
limit = parseInt(limit, 10);
}
var mimetype = options.mimetype || options.minetype || mime.lookup(this.resourcePath);
// No limits or limit more than content length
if(!limit || content.length < limit) {
if(typeof content === "string") {
content = new Buffer(content);
}
return "module.exports = " + JSON.stringify("data:" + (mimetype ? mimetype + ";" : "") + "base64," + content.toString("base64"));
}
var fileLoader = require("file-loader");
return fileLoader.call(this, content);
}
module.exports.raw = true;
url-loader-0.5.9/package.json 0000664 0000000 0000000 00000000753 13117541025 0016065 0 ustar 00root root 0000000 0000000 {
"name": "url-loader",
"version": "0.5.9",
"author": "Tobias Koppers @sokra",
"description": "url loader module for webpack",
"license": "MIT",
"scripts": {
"release": "standard-version"
},
"dependencies": {
"loader-utils": "^1.0.2",
"mime": "1.3.x"
},
"devDependencies": {
"standard-version": "^4.0.0"
},
"peerDependencies": {
"file-loader": "*"
},
"repository": {
"type": "git",
"url": "git@github.com:webpack/url-loader.git"
}
}