modularscale / modularscale-sass

Modular scale calculator built into your Sass
http://www.modularscale.com
MIT License
1.98k stars 132 forks source link

invalid operands for multiplication - libsass #93

Closed DenisMir closed 7 years ago

DenisMir commented 9 years ago

When trying to compile some scss files using the ms function I'm getting the invalid operands for multiplication error with libsass. With the normal sass implemented in ruby everything works fine. At the moment I am compiling with node-sass which uses libsass in version 3.1.0.

Is this a known error?

scottkellum commented 9 years ago

I am unable to replicate this error. What settings are you using for modular scale?

DenisMir commented 9 years ago

I'm sorry I have found the error. It was a bit down the stack in libsass. It lead to the ratio submitted to the ms function being an empty string which lead to the error mentioned above. The issue can be closed.

jackmcconnell commented 9 years ago

I'm also getting this when trying to do something like: padding: ms(5) ms(10) (ms(5) * 0.85) ms(6); Prepending round to the calculation doesn't fix it either.

In the libsass the error is: invalid operands for multiplication. Using the built-in compiler in CodeKit, the error is: Undefined operation: "ms-round-px(7.03125px) times 0.85".

I think this has something to do with the round function missing from the 1.0 version in the latest release. For now, i'll downgrade to a previous version of modular-scale in order to get it working.

Edit: For reference, I was using 2.0.4 when it was last working. Updating to 2.0.7 breaks things. Haven't tested 2.0.6.

jackmcconnell commented 9 years ago

Still getting this in 2.1.1.

scottkellum commented 9 years ago

@voltronik thanks for the update, I’ll reopen this case.

jackmcconnell commented 8 years ago

Just coming back to this because I've come across it in another situation. Doing this works:

padding-top: (ms(3) * 2)

...but doing this doesn't:

$top-padding: ms(3); padding-top: ($top-padding * 2)

Any thoughts on why this might be?

scottkellum commented 7 years ago

3.0 is out which should fix things, please ping this issue again if problems persist.

juliancalzada commented 6 years ago

Hi, using 3.0.7 and I am still seeing this:

  font-size: ms-round-px(16px);
  line-height: ms-round-px(20px);
  padding: ms-round-px(10.24px) ms-round-px(12.8px);

am i doing something wrong? here are my settings:

$base-font-size: 16px;
$modularscale:   (
  base:          $base-font-size,
  ratio:         $major-third,
  320px:         (
    base:        $base-font-size,
    ratio:       $major-third
  ),
  640px:         (
    base:        $base-font-size,
    ratio:       $fourth
  ),
  960px:         (
    base:        $base-font-size,
    ratio:       $fifth
  ),
  1280px:        (
    base:        $base-font-size,
    ratio:       $golden
  )
);
scottkellum commented 6 years ago

@lockheartmac see #159