pax_global_header00006660000000000000000000000064131175410250014511gustar00rootroot0000000000000052 comment=5574ed3ec10c71440f6de32f0abcd5d2609ffb79 url-loader-0.5.9/000077500000000000000000000000001311754102500135725ustar00rootroot00000000000000url-loader-0.5.9/.github/000077500000000000000000000000001311754102500151325ustar00rootroot00000000000000url-loader-0.5.9/.github/ISSUE_TEMPLATE.md000066400000000000000000000013331311754102500176370ustar00rootroot00000000000000 **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.md000066400000000000000000000013141311754102500207320ustar00rootroot00000000000000 **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/.gitignore000066400000000000000000000000141311754102500155550ustar00rootroot00000000000000node_modulesurl-loader-0.5.9/CHANGELOG.md000066400000000000000000000015001311754102500153770ustar00rootroot00000000000000# 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/LICENSE000066400000000000000000000020571311754102500146030ustar00rootroot00000000000000Copyright 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.md000066400000000000000000000103531311754102500150530ustar00rootroot00000000000000[![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 ```

Usage

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


Juho Vepsäläinen

Joshua Wiens

Artem Sapegin

Michael Ciniawsky

Alexander Krasnoyarov
[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.js000066400000000000000000000021111311754102500152320ustar00rootroot00000000000000/* 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.json000066400000000000000000000007531311754102500160650ustar00rootroot00000000000000{ "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" } }