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

Refactor #46

Closed
scottkellum opened this issue Mar 4, 2013 · 6 comments
Closed

Refactor #46

scottkellum opened this issue Mar 4, 2013 · 6 comments

Comments

@scottkellum
Copy link
Member

I think there is a lot we can simplify and consolodate here as well as writing more in Ruby.

I started a new branch where I am working on some things. Architecture wise I think we can make this tighter.

ms-function($n)
  @if multi-ratio or multi-size
    list: ()
    from 0 - $n
      add each ratio to list
      add each size to list
    sort list, trim list
    return nth list ($n)
  @else
    return basic math

This should be faster, easier to read, and more DRY. Hunting down issue #33 is a nightmare in the current iteration.

We should also have the math consolidated in the ruby instead of broken in both ruby and Sass. Starting to explore some here: https://github.com/scottkellum/modular-scale/tree/refactor

@scottkellum
Copy link
Member Author

Thinking about not doing this in Ruby, only because Compass isn’t the only front-end package manager these days and there is no way to get this working with lib-sass.

It will be tricky to do this within a performance budget, but then we could push to Compass/Bower/Yeoman/Bourbon/flat-file…

Note foundation dropped modular-scale as they are moving away from Compass as a strict dependency.

@codingdesigner
Copy link
Contributor

hmm. It's going to be tricky to keep performance a priority w/o dropping features. I hear you on that reasoning tho. I'll try to think about this this week tho.

@scottkellum
Copy link
Member Author

Yeah, dropping too many features.

The major hit is with the lack of exponent support in Sass making non-positive integer values difficult to calculate. That on top of list sorting is too much of a performance hit to recover from. Submitted a feature request to Sass core: sass/sass#684

I feel like there has to be a way to do list sorting more efficiently in Sass, even toying with ideas around caching to variables to skip a few calculation cycles. At any rate, looks like this has to be in Ruby for now…

@ottobyte
Copy link

Sorry if I'm jumping in here, is this the reason why when I use:
+adjust-font-size-to( ms(-2) , 1)
+leader( ms(-2), 1)
I get large 'incorrect' spacing as opposed to tighter ones?

@scottkellum
Copy link
Member Author

@ottobyte Not this issue in particular, but probably issue #33 If you are using multiple bases or multiple ratios.

@scottkellum
Copy link
Member Author

its done

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