From 688c0d5edc628377e94f8fe4c5ee6ad2d3376aba Mon Sep 17 00:00:00 2001 From: Niko Sams Date: Sun, 31 Aug 2014 18:07:26 +0200 Subject: [PATCH 1/3] add very basic implementation of opposite-position function this is implemented in compass as ruby code --- lib/compass/_functions.scss | 1 + lib/compass/functions/_constants.scss | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 lib/compass/functions/_constants.scss diff --git a/lib/compass/_functions.scss b/lib/compass/_functions.scss index e57e52f..5b722d4 100644 --- a/lib/compass/_functions.scss +++ b/lib/compass/_functions.scss @@ -1 +1,2 @@ @import "functions/lists"; +@import "functions/constants"; diff --git a/lib/compass/functions/_constants.scss b/lib/compass/functions/_constants.scss new file mode 100644 index 0000000..322f79c --- /dev/null +++ b/lib/compass/functions/_constants.scss @@ -0,0 +1,18 @@ +/* + * A partial implementation of the Ruby constants functions from Compass: + * https://github.com/Compass/compass/blob/stable/lib/compass/sass_extensions/functions/constants.rb + */ + +@function opposite-position($from) { + @if ($from == top) { + @return bottom; + } @else if ($from == bottom) { + @return top; + } @else if ($from == left) { + @return right; + } @else if ($from == right) { + @return left; + } @else if ($from == center) { + @return center; + } +} From 9611114bc1492983d4d1664ab6f57d72101fcd29 Mon Sep 17 00:00:00 2001 From: Wataru Hirayama Date: Wed, 3 Sep 2014 14:29:06 +0900 Subject: [PATCH 2/3] add elements-of-type function. --- lib/compass/_functions.scss | 1 + lib/compass/functions/_display.scss | 36 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 lib/compass/functions/_display.scss diff --git a/lib/compass/_functions.scss b/lib/compass/_functions.scss index 5b722d4..d00590a 100644 --- a/lib/compass/_functions.scss +++ b/lib/compass/_functions.scss @@ -1,2 +1,3 @@ @import "functions/lists"; @import "functions/constants"; +@import "functions/display"; diff --git a/lib/compass/functions/_display.scss b/lib/compass/functions/_display.scss new file mode 100755 index 0000000..0d6a7cb --- /dev/null +++ b/lib/compass/functions/_display.scss @@ -0,0 +1,36 @@ +/* + * A partial implementation of the Ruby display functions from Compass: + * https://github.com/Compass/compass/blob/stable/core/lib/compass/core/sass_extensions/functions/display.rb + */ + +@function elements-of-type($type){ + @if ($type == block){ + @return address, article, aside, blockquote, center, dir, div, dd, details, dl, dt, fieldset, figcaption, figure, form, footer, frameset, h1, h2, h3, h4, h5, h6, hr, header, hgroup, isindex, main, menu, nav, noframes, noscript, ol, p, pre, section, summary, ul; + } @else if ($type == inline){ + @return a, abbr, acronym, audio, b, basefont, bdo, big, br, canvas, cite, code, command, datalist, dfn, em, embed, font, i, img, input, keygen, kbd, label, mark, meter, output, progress, q, rp, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, textarea, time, tt, u, var, video, wbr; + } @else if ($type == inline-block){ + @return img; + } @else if ($type == table){ + @return table; + } @else if ($type == list-item){ + @return li; + } @else if ($type == table-row-group){ + @return tbody; + } @else if ($type == table-header-group){ + @return thead; + } @else if ($type == table-footer-group){ + @return tfoot; + } @else if ($type == table-row){ + @return tr; + } @else if ($type == table-cell){ + @return th, td; + } @else if ($type == html5-block){ + @return article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary; + } @else if ($type == html5-inline){ + @return audio, canvas, command, datalist, embed, keygen, mark, meter, output, progress, rp, rt, ruby, time, video, wbr; + } @else if ($type == html5){ + @return article, aside, audio, canvas, command, datalist, details, embed, figcaption, figure, footer, header, hgroup, keygen, main, mark, menu, meter, nav, output, progress, rp, rt, ruby, section, summary, time, video, wbr; + } @else if ($type == text-input){ + @return input, textarea; + } +} From f0cbaff8d67d9d1769a2ff2f1dd87dcc03f375fc Mon Sep 17 00:00:00 2001 From: Guillaume Balaine Date: Wed, 3 Sep 2014 11:34:27 +0200 Subject: [PATCH 3/3] Update README.markdown --- README.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.markdown b/README.markdown index 0480836..062156d 100644 --- a/README.markdown +++ b/README.markdown @@ -10,6 +10,10 @@ This project includes reasonably similar implementations of some of the Ruby fun To make those functions available to your compass mixins, you'll want to either `@import "compass";` or `@import "compass/functions"'` before the specific compass scss files you import. +## Contributors +Guillaume Balaine Igosuki@github +Michael Heillein nichaek@github + ## License Copyright (c) 2008-2009 Christopher M. Eppstein
All Rights Reserved.