css-b64-images
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -6,3 +6,16 @@ var fs = require('fs'), | ||
absoluteUrlRegex = /^\//, | ||
externalUrlRegex = /http/; | ||
externalUrlRegex = /http/, | ||
mediatypes = { | ||
'eot' : 'application/vnd.ms-fontobject', | ||
'gif' : 'image/gif', | ||
'ico' : 'image/vnd.microsoft.icon', | ||
'jpg' : 'image/jpeg', | ||
'jpeg' : 'image/jpeg', | ||
'otf' : 'application/x-font-opentype', | ||
'png' : 'image/png', | ||
'svg' : 'image/svg+xml', | ||
'ttf' : 'application/x-font-ttf', | ||
'webp' : 'image/webp', | ||
'woff' : 'application/x-font-woff' | ||
}; | ||
@@ -61,3 +74,3 @@ module.exports = { | ||
var ext = imagePath.substr(imagePath.lastIndexOf('.') + 1); | ||
var newCss = css.replace(imageUrl, 'data:image/' + ext + ';base64,' + img); | ||
var newCss = css.replace(imageUrl, 'data:' + mediatypes[ext] + ';base64,' + img); | ||
cb(null, newCss); | ||
@@ -64,0 +77,0 @@ }); |
@@ -5,3 +5,3 @@ { | ||
"description": "Base64 images in your css", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"main": "lib/css-b64-images.js", | ||
@@ -8,0 +8,0 @@ "bin": "bin/css-b64-images", |
@@ -0,1 +1,2 @@ | ||
[![build status](https://secure.travis-ci.org/Filirom1/css-base64-images.png)](http://travis-ci.org/Filirom1/css-base64-images) | ||
css-base64-images | ||
@@ -2,0 +3,0 @@ ================= |
@@ -36,2 +36,4 @@ var Path = require('path'), | ||
css.should.include(".not-found {\n background: url('../img"); | ||
css.should.include(".mediatype {\n background: url('data:image/svg+xml;base64,"); | ||
} |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
1155190
21
167
75
1