Skip to content

Update to PostCSS 6 #5

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 8 commits into from
May 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 0 additions & 7 deletions .npmignore

This file was deleted.

4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
language: node_js
node_js:
- "5"
- "4"
- "0.12"
- 4.5
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
## 2.0
* Use PostCSS 6x
* Use Node 4x syntax

## 1.0
* Initial release
22 changes: 9 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
var postcss = require('postcss');
const postcss = require('postcss');

module.exports = postcss.plugin('postcss-replace-overflow-wrap', function (opts) {
module.exports = postcss.plugin('postcss-replace-overflow-wrap', (opts) => {
opts = opts || {};
var method = opts.method || 'replace';
const 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();
}
}
});
return (css) => {
css.walkDecls('overflow-wrap', (decl) => {
decl.cloneBefore({ prop: 'word-wrap' });
if (method === 'replace') {
decl.remove();
}
});
};
});
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-replace-overflow-wrap",
"version": "1.0.0",
"version": "2.0.0",
"description": "PostCSS plugin to replace overflow-wrap with word-wrap or optionally retain both declarations.",
"keywords": [
"postcss",
Expand All @@ -16,13 +16,16 @@
"url": "https://github.com/MattDiMu/postcss-replace-overflow-wrap/issues"
},
"homepage": "https://github.com/MattDiMu/postcss-replace-overflow-wrap",
"files": [
"index.js"
],
"dependencies": {
"postcss": "^5.0.16"
"postcss": "^6.0.1"
},
"devDependencies": {
"ava": "^0.14.0",
"eslint": "^2.1.0",
"eslint-config-postcss": "^2.0.0"
"ava": "^0.19.1",
"eslint": "^3.19.0",
"eslint-config-postcss": "^2.0.2"
},
"scripts": {
"test": "ava && eslint *.js"
Expand Down