Skip to content

Commit

Permalink
allow non-numeric values in spacing methods per #104
Browse files Browse the repository at this point in the history
  • Loading branch information
eoneill committed Feb 3, 2015
1 parent cb21038 commit 1feb9af
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- added `archetype-bundled` extension which is a "kitchen sink" bundle of Archetype core and all official extensions
- added `styleguide_allow_missing` compiler option to force errors on missing styleguide identifiers

### Resolved Issues:

- allow non-multiplier values in `*-spacing` methods

## 1.0.0.alpha.4

### Resolved Issues:
Expand Down
3 changes: 3 additions & 0 deletions lib/archetype/sass_extensions/functions/util/spacing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def _archetype_integerize(number, abuse = bool(false))
#
def _spacing(unit = null, direction = identifier(horizontal), abuse = bool(false))
return null if helpers.is_null(unit)

return unit unless (unit.is_a?(Sass::Script::Value::Number) && unitless(unit).to_bool)

unit = _archetype_integerize(unit, abuse)
direction = helpers.to_str(direction) == 'vertical' ? 'VERTICAL' : 'HORIZONTAL'
config = "CONFIG_#{direction}_SPACING"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ e {
margin-left: 0px;
margin-right: 0px;
}

f {
padding-left: auto;
padding-right: 25px;
padding-left: 15px;
padding-right: 5px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ e {
@include horizontal-spacing($left: 0, $right: 0);
@include horizontal-spacing($left: 0, $right: 0, $method: margin);
}

f {
@include horizontal-spacing(auto 5);
@include horizontal-spacing(3 5px);
}

0 comments on commit 1feb9af

Please sign in to comment.