matype / stylefmt

stylefmt is a tool that automatically formats stylesheets.
Other
2.1k stars 89 forks source link

Variables declared as Map are forcely inlined. #331

Open danfma-daitan opened 6 years ago

danfma-daitan commented 6 years ago

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.

ronilaukkarinen commented 4 years ago

This is very frustrating. How to prevent inlining?

ronilaukkarinen commented 4 years ago

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