Skip to content

Commit

Permalink
ixed: preserve option does not create duplicated values (4.0.1)
Browse files Browse the repository at this point in the history
Close #7
  • Loading branch information
MoOx committed Apr 9, 2015
1 parent 48b84a2 commit 51ee3f8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 4.0.1 - 2015-04-09

- Fixed: `preserve` option does not create duplicated values ([#7](https://github.com/postcss/postcss-calc/issues/7))

# 4.0.0 - 2015-01-26

- Added: compatibility with postcss v4.x
Expand Down
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ module.exports = function plugin(options) {
return
}

var clone = decl.clone()
clone.value = value
decl.parent.insertBefore(decl, clone)
if (value != decl.value) {
var clone = decl.clone()
clone.value = value
decl.parent.insertBefore(decl, clone)
}
}, decl.source)
})
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-calc",
"version": "4.0.0",
"version": "4.0.1",
"description": "PostCSS plugin to reduce calc()",
"keywords": [
"css",
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/preserve.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
calc {
value: calc(1/3);
value: calc(100% + 1px);
}
1 change: 1 addition & 0 deletions test/fixtures/preserve.expected.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
calc {
value: 0.33333;
value: calc(1/3);
value: calc(100% + 1px);
}

0 comments on commit 51ee3f8

Please sign in to comment.