zellwk / typi

A sass mixin to make responsive typography easy
MIT License
857 stars 43 forks source link

Non-integer exponents (modular-scale 2.x + ratios in $typi config) #57

Closed strarsis closed 5 years ago

strarsis commented 5 years ago

@zellwk: Does typi handle internally non-integer exponents, which would be rations used as input for ms-* functions?

I get this warning/notice when using modular-scale 2.x (as required by typi), when using a ratio instead an integer in $typi configuration map:

$typi: (
  medlarge: (
    null: (ms(1.5), 1.45)
  )
);
WARNING: Unfortunately, you need Compass to use non-integer exponents
zellwk commented 5 years ago

@strarsis Typi doesn't handle non-integer exponents. If you want this, you'll need a pow() function.

From Modular Scale's README:

Note on non-integer values

Unfortunately Sass doesn’t natively support exponents. This isn’t all bad news, you can either use Compass, mathsass, or another library that has a pow() function that supports non-integer values and this plugin will pick up on that function and use it. You will then be able to write values like ms(2.5). This is also a prerequisite for target sizes below.

strarsis commented 5 years ago

Note: import mathsass before importing modular-scale (which is used by typi):

webpack example:

@import '~mathsass/dist/math';
@import '~modularscale-sass/stylesheets/modular-scale';
@import '~typi/scss/typi';