Skip to content

Commit

Permalink
Updated to declarative Rule method (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
DenyVeyten authored Sep 20, 2020
1 parent b4d3c1e commit a70d0fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
10 changes: 4 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ module.exports = ({

return {
postcssPlugin: 'postcss-deadcss',
Root(root) {
root.walkRules((rule) => {
const safeUrlComponent = getSafeUrlComponent(rule.selector);
const safeUrl = utils.getSafeUrl(url, safeUrlComponent);
Rule(rule) {
const safeUrlComponent = getSafeUrlComponent(rule.selector);
const safeUrl = utils.getSafeUrl(url, safeUrlComponent);

rule[insertFnName]({ prop: 'background-image', value: `url('${safeUrl}')` });
});
rule[insertFnName]({ prop: 'background-image', value: `url('${safeUrl}')` });
},
};
};
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"husky": "^4.3.0",
"jest": "^26.4.2",
"lint-staged": "^10.4.0",
"postcss": "^8.0.5"
"postcss": "^8.0.6"
},
"peerDependencies": {
"postcss": "^8.0.5"
"postcss": "^8.0.6"
},
"husky": {
"hooks": {
Expand Down

0 comments on commit a70d0fb

Please sign in to comment.