Susy: `Unknown shorthand property: [null]` on v3-alpha5

Created on 24 Apr 2017  ·  12Comments  ·  Source: oddbird/susy

Hi, @mirisuzanne .

One of my coworkers just found a bug on version alpha 5:

    _src/stylesheets/vendor/susy/_utilities.scss
Error: [susy-parse] Unknown shorthand property: [null] ``
        on line 59 of _src/stylesheets/vendor/susy/_utilities.scss
>>   @error '[#{$source}] #{$message}';
   --^

Bye!

Most helpful comment

Fixed in 67fd19354e9eb34172686ff34d8bf34e407d59e0 - released in https://github.com/oddbird/susy/releases/tag/3.0.0.alpha.6 - enjoy!

All 12 comments

Thanks @robsonsobral - can you give me any more context around how you triggered the bug? What were they trying to do?

I just tried to rebuild a project made using alpha1 and GULP.

Is there some change I can make to try to find the line which triggered the bug?

Hmmm, are there any places you are passing null into Susy? The parser is throwing an error because it doesn't understand null as a valid value in the Susy shorthand.

I can't find any.

My config:

$susy: (
    'columns': 12 x (70 / 16 * 1rem),
    'gutters': (30 / 16 * 1rem),
);

Some samples of code you may want to add to tests:

  • (span(7) * -1 - gutter() * .5)
  • $grid: susy-normalize($grid)
  • span(12 'wider');
  • width: calc(50% + #{span(6 'wide') + gutter() * .5});
  • (span(1) / 2)
  • margin: (span(1) * -1) auto span(1);
  • margin: 0 gutter() gutter() 0;

Oh, I like all the weird ways you're using it! :)

  • Doing math with the results of a span is not something we control, so I'm not worried about those.
  • $grid: susy-normalize($grid) depends completely on the value of $grid. Where are you using that? We do normalization internally when we parse, so that's probably not necessary in most cases.
  • I think it works to do span(0.5) instead of (span(1) / 2)

Everything else in there is already tested on our end. Can you try commenting out partials, or lines of code, to narrow it down?

I'm using $grid: susy-normalize($grid) on my grid mixin. The one I sent you last year.

Tomorrow I try to find the source of the issue. I had a loooooooong day. I'm sorry.

Thank you so much, @mirisuzanne .

Hi, @mirisuzanne .

I found that any gutter() breaks the code. So, problably it's a config problem.

I tried to change the config to:

$susy: (
    'columns': 12,
    'gutters': 0.5
);

and:

$susy: (
    'columns': 12 x 4.375em,
    'gutters': 1.875em
);

Without luck.

Is there any special place I should put the config map?

Based on #631, it sounds like this error can be triggered with an empty gutter() function.

Yeap! gutter(1) fi... Prevent it!

I think the problem is in the parser, not in your config.

In the meantime, any single number passed to gutter() will act as context, so use 12 for a 12-column grid, and you should get what you need.

It's too much to change right now, Miriam. It's safer to stay on alpha 1. Thank you!

Fixed in 67fd19354e9eb34172686ff34d8bf34e407d59e0 - released in https://github.com/oddbird/susy/releases/tag/3.0.0.alpha.6 - enjoy!

Was this page helpful?
0 / 5 - 0 ratings