Skip to content

consolidate tree walkers #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use walkDecls without walkRules
  • Loading branch information
jonathantneal committed Mar 1, 2017
commit 6e6b9351be567fd24528d0c2a500efa167d81848
14 changes: 6 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ module.exports = postcss.plugin('postcss-replace-overflow-wrap', function (opts)
var method = opts.method || 'replace';

return function (css, result) { // eslint-disable-line no-unused-vars
css.walkRules(function (rule) {
rule.walkDecls(function (decl, i) { // eslint-disable-line no-unused-vars
if (decl.prop === 'overflow-wrap') {
decl.cloneBefore({ prop: 'word-wrap' });
if (method === 'replace') {
decl.remove();
}
css.walkDecls(function (decl, i) { // eslint-disable-line no-unused-vars
if (decl.prop === 'overflow-wrap') {
decl.cloneBefore({ prop: 'word-wrap' });
if (method === 'replace') {
decl.remove();
}
});
}
});
};
});