modularcode / modular-admin-html

ModularAdmin - Free Dashboard Theme Built On Bootstrap 4 | HTML Version
https://modularcode.io/modular-admin-html/
Other
2.92k stars 818 forks source link

Why is there a theme compiler (theme.js etc.)? #71

Open ghost opened 7 years ago

ghost commented 7 years ago

Could you please explain the benefits and why there is a "theme compiler" (theme.js etc.)? In my opinion only using SASS would make more sense because:

modularcoder commented 7 years ago

Hi @Omnia-Code Do you mean v2 dev branch?

ghost commented 7 years ago

Yes, I talking about the v2 dev branch, sorry I wasn't clear. The v1 uses plain SASS. By the way, the custom CSS properties feature is a experimental technology. Therefore I would be careful using it.

modularcoder commented 7 years ago

@Omnia-Code this is a great question, I'll try to give a detailed response soon )

modularcoder commented 7 years ago

@Omnia-Code ok finally got some time to respond, sorry for the delay.

Why do we need variables in the js file?

The reason for src/_theme/variables.js and src/_theme/theme.js is because in some component JS files we need to refer to theme's variables: mostly colors. So variables.js is kind of single source of truth for the theme. variables.js are also injected into SASS variables.scss files in SASS format.

Why do we also need css custom properties?

This is mostly for theme demo on-the fly customization without the need to precompile different variations. So in most of browsers you can customize the theme on the fly just by changing CSS properties. For the browsers that don't support css custom properties (Hello IE :) ) there is a fallback.

CSS properties can be omitted for real production use.