postcss-base64
Advanced tools
Comparing version 0.5.1 to 0.6.0
19
index.js
@@ -45,2 +45,6 @@ var fs = require('fs'), | ||
if(opts.excludeAtFontFace === undefined) { | ||
opts.excludeAtFontFace = true; | ||
} | ||
if(opts.extensions) { | ||
@@ -50,4 +54,15 @@ exts = '\\' + opts.extensions.join('|\\'); | ||
css.replaceValues(search, function (string) { | ||
return replaceFiles(string, opts); | ||
css.each(function (node) { | ||
if( | ||
opts.excludeAtFontFace && | ||
node.type === 'atrule' && | ||
node.name === 'font-face' | ||
) { | ||
// Don't do @font-face rules | ||
return; | ||
}; | ||
node.replaceValues(search, function (string) { | ||
return replaceFiles(string, opts); | ||
}); | ||
}); | ||
@@ -54,0 +69,0 @@ } |
{ | ||
"name": "postcss-base64", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "Replace values in url() statements with base64 encoded strings.", | ||
@@ -13,3 +13,3 @@ "author": "Jelmer de Maat", | ||
"scripts": { | ||
"test": "ava" | ||
"test": "ava --verbose" | ||
}, | ||
@@ -16,0 +16,0 @@ "dependencies": { |
@@ -45,3 +45,8 @@ postcss-base64, a [PostCSS](https://github.com/postcss/postcss/) plugin, replaces urls or values inside `url()` functions with their base64 encoded strings. | ||
#### excludeAtFontFace | ||
Boolean, defines wether `@font-face` rules are ignored. Default: `true`. | ||
`excludeAtFontFace: false` | ||
### NodeJS | ||
@@ -48,0 +53,0 @@ Using PostCSS in NodeJS, the approach would be as follows: |
@@ -19,4 +19,4 @@ var fs = require('fs'), | ||
test('Check output prepended', t => { | ||
test('Output with `prepend` option is as expected', t => { | ||
t.is(expectedFile, outputFileContents, 'Expected code and output code are not the same.'); | ||
}); |
@@ -19,4 +19,4 @@ var fs = require('fs'), | ||
test('Check output', t => { | ||
test('Output is as expected', t => { | ||
t.is(expectedFile, outputFileContents, 'Expected code and output code are not the same.'); | ||
}); |
Sorry, the diff of this file is not supported yet
13109
17
181
103
5