Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorthand layout() doesn't accept unitless gutter size #392

Open
rami opened this issue Oct 10, 2014 · 3 comments
Open

Shorthand layout() doesn't accept unitless gutter size #392

rami opened this issue Oct 10, 2014 · 3 comments

Comments

@rami
Copy link

rami commented Oct 10, 2014

@include layout(4 (240px 60px)); works correctly, and gives 0.25 gutter size.

@include layout(4 (240px 0.25)); causes Sass to carp with error:
Sass::SyntaxError: 0.00104/px isn't a valid CSS value.

Is this expected behavior? I have a patch to fix it, but just want to check first if this is intentional or not.

@mirisuzanne
Copy link
Member

Yes, that is currently the expected behavior. I'd love to make the shorthand syntax even more flexible (and make some changes to column/gutter/width handling), but it's not at the top of the list right now.

@rami
Copy link
Author

rami commented Oct 10, 2014

Do you mind if I adjust it to accept @include layout(4 (240px 0.25)) syntax? I generated a patch, and I'm happy to fork and pull request as well. I'm just not sure what's best for you for simple editions like this.

rake test said 57 Tests Passed, so there don't seem any obvious issues.

---
 sass/susy/language/susy/_settings.scss | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sass/susy/language/susy/_settings.scss b/sass/susy/language/susy/_settings.scss
index 1d94e52..557070e 100644
--- a/sass/susy/language/susy/_settings.scss
+++ b/sass/susy/language/susy/_settings.scss
@@ -90,7 +90,7 @@ $susy-keywords: (

   @if type-of($_gutters) == list and length($_gutters) > 0 {
     $_gutters: (
-      gutters: nth($_gutters, 2) / nth($_gutters, 1),
+      gutters: if(unitless(nth($_gutters, 2)), nth($_gutters, 2), nth($_gutters, 2) / nth($_gutters, 1)),
       column-width: nth($_gutters, 1),
     );
   } @else {
--
2.1.2

@mirisuzanne
Copy link
Member

Absolutely! Submit a pull request!

We'll want to add tests specifically for this case, and also update the docs/changelog — is that something you can look into? I'm happy to point you in the right direction if you have questions.

Thanks!

@mirisuzanne mirisuzanne added the v2 label Sep 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants