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

Variable outputs ms function, not value #127

Closed
jackmcconnell opened this issue Jun 7, 2016 · 5 comments
Closed

Variable outputs ms function, not value #127

jackmcconnell opened this issue Jun 7, 2016 · 5 comments

Comments

@jackmcconnell
Copy link

Pretty sure this isn't a bug with modular scale but wanted to ask here to see if you can help.

I have a variable defined like so: $primary-margin: ms(6);
I use it like this in my Sass files: margin-bottom: $primary-margin;
When the Sass compiles to CSS however, it looks like this: margin-bottom: ms(6);

Naturally, it should be outputting a value (px, rem, em, or %) though. I've tried:
margin-bottom: calc($primary-margin); (calculating first)
margin-bottom: #{$primary-margin}; (interpolation)
...but nothing seems to work.

Do you know why this might be or what I need to do to get this to work?

Thanks,
Jack

@scottkellum
Copy link
Member

@voltronik It sounds like the plugin is not installed properly and the ms() function is not found in your stylesheet. When a Sass function is not available it outputs the function as you see it.

What method did you use to install modular scale?

@jackmcconnell
Copy link
Author

jackmcconnell commented Jun 7, 2016

Hi @scottkellum - thanks for getting back to me.
I used Bower via CodeKit. Just checked and the plugin is up to date (v2.1.3 according to CodeKit).

I'm referencing the file in my style.scss file like so:
@import "../../bower_components/modular-scale/stylesheets/modular-scale";

I then have a variables.scss file that has $primary-margin: ms(6); in it, referenced after the above import.
I then reference this in a base.scss file which is imported last in my style.scss file.

It works everywhere else, just not when being reference within a variable.
If I replace margin-bottom: $primary-margin; with margin-bottom: ms(6); it works perfectly.

@scottkellum
Copy link
Member

scottkellum commented Jun 7, 2016

Hm, that sounds like a Sass bug then, Sass should be parsing that as a function.

edit: I’m chatting with some people to figure out where this issue is.

@jackmcconnell
Copy link
Author

Thanks!

@johnstonian
Copy link

i have experienced the same issue. was the bug figured out? if so, what is the fix?

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants