2

In SCSS, this ...

body { color: red; font-size: 1em; }
body { color: blue; }

... will be compiled into the exact same code:

body { color: red; font-size: 1em; }
body { color: blue; }

However, is it possible to render the values of overwritten properties only, so that the result will be that:

body { color: blue; font-size: 1em; }

I know that this could be easily done with mixins and default arguments but that is not the point... I'd like to define a default stylesheet, that I can import, extend and overwrite without having all the initial values compiled and without touching the default file at all.

A good comparison from the JavaScript world is to have an object with default values that will be extended with another object that adds new properties and overwrites the existing properties before stringifing the final object into a JSON object - just consider that the JSON object is the final CSS output while the JS objects are declaration blocks in Sass...

Is that possible?

headacheCoder
  • 4,503
  • 8
  • 30
  • 33
  • You can compile a 'default' stylesheet, then compile separate secondary stylesheets to override those default properties. For example, compile default.css that runs on every view, then load override stylesheets on specific views, like redpage.css, greenpage.css, etc – bingo Oct 28 '15 at 13:13
  • Alternate duplicates: http://stackoverflow.com/questions/19451296/merging-selectors-from-mixins, http://stackoverflow.com/questions/27481742/how-to-avoid-duplicate-entries-in-scss-sass, etc. – cimmanon Oct 28 '15 at 13:23

0 Answers0