base64-image-loader
Advanced tools
Comparing version 1.2.0 to 1.2.1
13
index.js
@@ -6,6 +6,11 @@ 'use strict'; | ||
function getMime(path) { | ||
const extension = path.split('.').pop().toLowerCase(); | ||
const extension = path | ||
.split('.') | ||
.pop() | ||
.toLowerCase(); | ||
const mime = mimes[extension]; | ||
if (!mime) { | ||
throw new Error('Unsupported type of image of extension ' + extension + ': ' + path); | ||
throw new Error( | ||
'Unsupported type of image of extension ' + extension + ': ' + path | ||
); | ||
} | ||
@@ -17,4 +22,6 @@ return mime; | ||
this.cacheable && this.cacheable(); | ||
return `module.exports = "data:${getMime(this.resourcePath)};base64,${content.toString('base64')}"`; | ||
return `module.exports = "data:${getMime( | ||
this.resourcePath | ||
)};base64,${content.toString('base64')}"`; | ||
}; | ||
module.exports.raw = true; |
{ | ||
"name": "base64-image-loader", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "base64 image loader for webpack", | ||
@@ -10,13 +10,18 @@ "repository": { | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "mocha", | ||
"precommit": "lint-staged", | ||
"format": "npm run staged-format \"**/*.+(js|json)\"", | ||
"staged-format": "prettier --single-quote --write", | ||
"commitmsg": "commitlint -e" | ||
}, | ||
"keywords": [ | ||
"base64", | ||
"image", | ||
"webpack", | ||
"loader", | ||
"img", | ||
"src", | ||
"img src" | ||
], | ||
"keywords": ["base64", "image", "webpack", "loader", "img", "src", "img src"], | ||
"lint-staged": { | ||
"*.js": [ | ||
"npm run test", | ||
"npm run staged-format", | ||
"eslint --fix", | ||
"git add" | ||
], | ||
"*.json": ["npm run staged-format", "git add"] | ||
}, | ||
"bugs": "https://github.com/jahredhope/base64-image-loader/issues", | ||
@@ -27,8 +32,15 @@ "main": "index.js", | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"eslint": "^2.11.0", | ||
"eslint-config-airbnb-base": "^3.0.1", | ||
"eslint-plugin-import": "^1.8.1", | ||
"mocha": "^2.5.3" | ||
"@commitlint/cli": "^5.2.5", | ||
"@commitlint/config-angular": "^5.1.1", | ||
"chai": "^4.1.2", | ||
"commitlint": "^5.2.5", | ||
"eslint": "^4.13.0", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"husky": "^0.14.3", | ||
"lint-staged": "^6.0.0", | ||
"mocha": "^4.0.1", | ||
"prettier": "1.9.1" | ||
} | ||
} |
# base64 image loader for webpack | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/jahredhope/base64-image-loader.svg)](https://greenkeeper.io/) | ||
![](https://travis-ci.org/jahredhope/base64-image-loader.svg?branch=master) | ||
@@ -4,0 +6,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71296
8
88
32
12