Skip to content

Commit

Permalink
handle content property (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
bezoerb committed Feb 5, 2016
1 parent 6397028 commit 95c9e6e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module.exports = postcss.plugin('postcss-image-inliner', function (opts) {

return function (css) {
var replacements = {};
var filter = /^background(?:-image)?/;
var filter = /^(background(?:-image)?)|(content)/;
css.walkDecls(filter, loop(function (decl, url) {
replacements[url] = resolveUrl(url);
}));
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/styles/pseudo.in.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.class:after {
content: url('../images/blank.gif');
}
3 changes: 3 additions & 0 deletions test/fixtures/styles/pseudo.out.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.class:after {
content: url('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
}
4 changes: 4 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ describe('postcss-image-inliner', function () {
test('missing.in.css', 'missing.out.css', { }, done);
});

it('should handle urls used for content property', function (done) {
test('pseudo.in.css', 'pseudo.out.css', { }, done);
});

it('should fail on missing files in strict mode', function (done) {
test('missing.in.css', 'missing.out.css', { strict: true }, function (error) {
if (error) {
Expand Down

0 comments on commit 95c9e6e

Please sign in to comment.