Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #6 from guardian/test-rem-scale-fix
Browse files Browse the repository at this point in the history
Improve test suite and add contribution guidelines
  • Loading branch information
kaelig committed Jul 18, 2014
2 parents 8043daa + d339baa commit fd0a1de
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 56 deletions.
2 changes: 0 additions & 2 deletions .gitignore
@@ -1,4 +1,2 @@
bower_components
node_modules
results.css
.sass-cache
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
## 1.1.1 (2014-07-18)

- Fix a recursion bug with a user-defined baseline parameter (thanks @HugoGiraudel)
- Add project to the [Sache](http://www.sache.in/ "Sache: Find Sass and Compass Extensions for your next project") registry

## 1.1.0 (2014-02-26)

- Unit testing with [Bootcamp](https://github.com/thejameskyle/bootcamp)
Expand Down
49 changes: 0 additions & 49 deletions Gruntfile.js

This file was deleted.

18 changes: 18 additions & 0 deletions README.md
Expand Up @@ -16,6 +16,7 @@ bower install guss-rem --save
@import "path/to/_rem.scss";
```


## Features

Use rem units in your CSS in a retro-compatible way.
Expand Down Expand Up @@ -58,3 +59,20 @@ Outputs:
height: 2rem;
}
```


## Contribute

Install the test dependencies:

```bash
$ bower install
```

Run the tests (specs are located in specs/rem.scss):

```bash
$ sass tests.scss -I './bower_components/bootcamp/dist'
```

Make sure tests pass before you commit any changes.
3 changes: 2 additions & 1 deletion _rem.scss
@@ -1,7 +1,7 @@
$guss-rem-baseline: 10px !default;

// Transform a value into rem
// Assuming baseline is set to 10px on :root/html
// Assuming baseline is set to 10px on :root or html
@function rem($value, $baseline: $guss-rem-baseline) {
@if $value == 0 { @return 0; } // 0rem -> 0
@if type-of($value) == list {
Expand All @@ -15,6 +15,7 @@ $guss-rem-baseline: 10px !default;
}
}


// Output rem units with px fallback
// Expects $properties to be a Sass map
// Usage: http://sassmeister.com/gist/7451284
Expand Down
5 changes: 2 additions & 3 deletions bower.json
@@ -1,14 +1,13 @@
{
"name": "guss-rem",
"version": "1.1.0",
"version": "1.1.1",
"main": "_rem.scss",
"ignore": [
"CHANGELOG.md",
"specs",
"Gruntfile.js",
"tests.scss"
],
"devDependencies": {
"bootcamp": "~1.1.4"
"bootcamp": "~1.1.6"
}
}
5 changes: 5 additions & 0 deletions sache.json
@@ -0,0 +1,5 @@
{
"name": "Guss-rem",
"description": "Transforms any pixel value and group of properties into their equivalent in rem units with a pixel fallback",
"tags": ["responsive", "rwd", "rem", "graceful degradation"]
}
5 changes: 5 additions & 0 deletions specs/rem.scss
Expand Up @@ -21,4 +21,9 @@
$guss-rem-baseline: 20px !global;
@include should( expect( rem(10px) ), to( equal(.5rem) ) );
}
@include it("should honour a different rem scale when passed as a parameter") {
$guss-rem-baseline: 10px !global; // Set default baseline back to its initial value
@include should( expect( rem(10px, 40px) ), to( equal(.25rem) ) );
@include should( expect( rem(10px 20px, 40px) ), to( equal(.25rem .5rem) ) );
}
}
2 changes: 1 addition & 1 deletion tests.scss
Expand Up @@ -6,4 +6,4 @@ $bc-setting-warnings: false;

@include runner-start;
@import "specs/rem";
@include runner-end;
@include runner-end;

0 comments on commit fd0a1de

Please sign in to comment.