diff --git a/changelog.md b/changelog.md index f06cd98..f577c48 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,13 @@ + +## 0.1.1 (2017-04-04) + +* 0.1.1 ([a9bdfd7](https://github.com/GitScrum/posthtml-class-to-css-module/commit/a9bdfd7)) +* fix(index): fix remove class ([19729b1](https://github.com/GitScrum/posthtml-class-to-css-module/commit/19729b1)) +* fix(package): fix version ([e441750](https://github.com/GitScrum/posthtml-class-to-css-module/commit/e441750)) +* chore(changelog): Update changelog ([7b21e0e](https://github.com/GitScrum/posthtml-class-to-css-module/commit/7b21e0e)) + + + ## 0.0.2 (2017-04-03) diff --git a/package.json b/package.json index eff8564..6df49b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "posthtml-class-to-css-module", - "version": "0.0.2", + "version": "0.1.1", "description": "A posthtml plugin for removing tags", "license": "MIT", "repository": "GitScrum/posthtml-class-to-css-module", diff --git a/src/index.js b/src/index.js index dafb1b2..afdd762 100644 --- a/src/index.js +++ b/src/index.js @@ -2,14 +2,18 @@ import Reflect from 'core-js/fn/reflect'; const clone = tree => tree.match( {attrs: {class: /.+/}}, - node => Object.assign(node, Object.assign(node.attrs, {'css-module': node.attrs.class})) + node => { + node.attrs = Object.assign(node.attrs, {'css-module': node.attrs.class}); + + return node; + } ); const removeClass = tree => tree.match( {attrs: {class: /.+/}}, node => { - console.log(node); - delete node.attrs.class; + node.attrs = Object.keys(node.attrs) + .reduce((attrs, key) => Object.assign(attrs, key === 'class' ? {} : {[key]: node.attrs[key]}), {}); return node; }