From 74321b401339850bd54b77ce51d49b15276c2637 Mon Sep 17 00:00:00 2001 From: Kaelig Date: Fri, 18 Jul 2014 11:22:31 +0100 Subject: [PATCH 1/5] Add Sache.in registry manifest --- sache.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 sache.json diff --git a/sache.json b/sache.json new file mode 100644 index 0000000..7e202a5 --- /dev/null +++ b/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"] +} From 010c0fac280cabe17128bad8426d88bb82263e72 Mon Sep 17 00:00:00 2001 From: Kaelig Date: Fri, 18 Jul 2014 11:23:19 +0100 Subject: [PATCH 2/5] Update dependencies and remove Gruntfile --- .gitignore | 2 -- Gruntfile.js | 49 ------------------------------------------------- bower.json | 5 ++--- 3 files changed, 2 insertions(+), 54 deletions(-) delete mode 100644 Gruntfile.js diff --git a/.gitignore b/.gitignore index 053e45e..7340ae6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ bower_components -node_modules -results.css .sass-cache \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index a53e0db..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,49 +0,0 @@ -module.exports = function(grunt) { - - // Modules - grunt.loadNpmTasks('grunt-init'); - grunt.loadNpmTasks('grunt-contrib-sass'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('bootcamp'); - - // Grunt Tasks - grunt.initConfig({ - meta: { - version: '0.0.3' - }, - - // Sass - sass: { - test: { - options: { - style: 'expanded', - loadPath: './node_modules/bootcamp/dist' - }, - files: { - './results.css': './tests.scss' - } - } - }, - - // Bootcamp - bootcamp: { - test: { - files: { - src: ['./results.css'] - } - } - }, - - // Watch - watch: { - dist: { - files: ['./**/*.scss'], - tasks: ['sass', 'bootcamp'] - } - } - }); - - // Tasks - grunt.registerTask('default', ['sass', 'bootcamp', 'watch']); - grunt.registerTask('test', ['sass', 'bootcamp']); -}; diff --git a/bower.json b/bower.json index 321b2a6..796da55 100644 --- a/bower.json +++ b/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" } } From 09cd49065e02bfb12992e3e5366f0004583fe7cc Mon Sep 17 00:00:00 2001 From: Kaelig Date: Fri, 18 Jul 2014 11:24:18 +0100 Subject: [PATCH 3/5] Add contribution guidelines --- CHANGELOG.md | 5 +++++ README.md | 18 ++++++++++++++++++ _rem.scss | 3 ++- tests.scss | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d78209..9e2d00e 100644 --- a/CHANGELOG.md +++ b/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) diff --git a/README.md b/README.md index 184b164..3f6c08f 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. diff --git a/_rem.scss b/_rem.scss index 73a942c..65c67e9 100644 --- a/_rem.scss +++ b/_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 { @@ -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 diff --git a/tests.scss b/tests.scss index 29c4425..55753d5 100644 --- a/tests.scss +++ b/tests.scss @@ -6,4 +6,4 @@ $bc-setting-warnings: false; @include runner-start; @import "specs/rem"; -@include runner-end; \ No newline at end of file +@include runner-end; From a8d09c7fbb4cabe137396949861ea14f919e28a2 Mon Sep 17 00:00:00 2001 From: Kaelig Date: Fri, 18 Jul 2014 11:24:39 +0100 Subject: [PATCH 4/5] Add tests for rem baseline passed as a parameter --- specs/rem.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/specs/rem.scss b/specs/rem.scss index 0e7b182..eea5d29 100644 --- a/specs/rem.scss +++ b/specs/rem.scss @@ -21,4 +21,8 @@ $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") { + @include should( expect( rem(10px, 20px) ), to( equal(.5rem) ) ); + @include should( expect( rem(10px 20px, 20px) ), to( equal(.5rem 1rem) ) ); + } } From d339baa5bec06926b9a73fc83dc1a066083ee5a6 Mon Sep 17 00:00:00 2001 From: Kaelig Date: Fri, 18 Jul 2014 11:35:25 +0100 Subject: [PATCH 5/5] Make baseline test more robust --- specs/rem.scss | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/specs/rem.scss b/specs/rem.scss index eea5d29..a7632ce 100644 --- a/specs/rem.scss +++ b/specs/rem.scss @@ -22,7 +22,8 @@ @include should( expect( rem(10px) ), to( equal(.5rem) ) ); } @include it("should honour a different rem scale when passed as a parameter") { - @include should( expect( rem(10px, 20px) ), to( equal(.5rem) ) ); - @include should( expect( rem(10px 20px, 20px) ), to( equal(.5rem 1rem) ) ); + $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) ) ); } }