Skip to content

Commit

Permalink
Minor ES6 tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Nov 11, 2019
1 parent 29c9acd commit 9f72b60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const DEFAULTS = {
assetPaths: [],
maxFileSize: 10240,
b64Svg: false,
strict: false
strict: false,
};

const loop = cb => {
Expand All @@ -35,7 +35,10 @@ module.exports = postcss.plugin('postcss-image-inliner', (opts = {}) => {
const urls = new Set([]);
const filter = /^(background(?:-image)?)|(content)|(cursor)/;
// Get urls
css.walkDecls(filter, loop(({url}) => urls.add(url)));
css.walkDecls(
filter,
loop(({url}) => urls.add(url))
);

const mapping = await getDataUriMapping([...urls], options);

Expand Down
4 changes: 2 additions & 2 deletions lib/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ async function resolve(filepath, {assetPaths, maxFileSize, resolver = () => unde

try {
return await getResource(file, {base, filter});
} catch (err) {
debug(err.message, filepath, 'could not be resolved');
} catch (error) {
debug(error.message, filepath, 'could not be resolved');
}
}

Expand Down
8 changes: 4 additions & 4 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ const path = require('path');
const fs = require('fs');
const http = require('http');
const postcss = require('postcss');
const assert = require('chai').assert;
const {assert} = require('chai');
const finalhandler = require('finalhandler');
const serveStatic = require('serve-static');

const plugin = require('../');
const plugin = require('..');

function read(filename) {
return fs.readFileSync(path.join(__dirname, 'fixtures/styles', filename), 'utf8');
Expand All @@ -29,8 +29,8 @@ const test = (input, output, opts = {}, done) => {
assert.isEmpty(result.warnings());
})
.then(done)
.catch(err => {
done(err);
.catch(error => {
done(error);
});
};

Expand Down

0 comments on commit 9f72b60

Please sign in to comment.