stylefmt icon indicating copy to clipboard operation
stylefmt copied to clipboard

Variables declared as Map are forcely inlined.

Open danfma-daitan opened this issue 8 years ago • 2 comments

SCSS has the ability to define variables as maps (https://codepen.io/jakealbaugh/post/using-sass-functions-to-access-complex-variable-maps), but actually, the Formatter enforces that all variables should be on the same line.

e.g.:

Something like this:

$buttonColors: (
  'primary': $primary-color,
  'success': $success-color,
  'warning': $warning-color,
  'danger': $danger-color,
  'info': $info-color
);

will become:

$buttonColors: (
  'primary': $primary-color, 'success': $success-color, 'warning': $warning-color, 'danger': $danger-color, 'info': $info-color
);

Which obviously, is not so readable.

danfma-daitan avatar Dec 28 '17 18:12 danfma-daitan

This is very frustrating. How to prevent inlining?

ronilaukkarinen avatar Mar 05 '20 13:03 ronilaukkarinen

I have currently solved this by commenting out the following line. Someone more experineced JS developer should make an exception for sass:maps.

https://github.com/morishitter/stylefmt/blob/875c9037590fa201bdd7698fbfa5c1943137cc86/lib/formatSassVariables.js#L46

ronilaukkarinen avatar Mar 05 '20 14:03 ronilaukkarinen