Skip to content
Advertisement

Pretty Printing the structure of nested SASS Maps?

If we have nested maps in SASS (an Angular Theme for example) we can log the contents of it with @debug however it outputs everything in one line.

Anyone know if SASS has something that will pretty print the structure of nested maps?

So for example if we had:

JavaScript

We could do something like

JavaScript

To log the structure of it.

Advertisement

Answer

I created a NPM package for this that is a SASS installable file.

JavaScript

https://www.npmjs.com/package/@fireflysemantics/sass-logger

This is from the usage section of the README.

JavaScript

This is a stackblitz demo of the package.

https://stackblitz.com/edit/angular-r9tzuk-ov8kx4

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement