I was recently attempting to build an extremely minimalistic, lightweight css framework (something like Pure CSS).
On inspecting my code, one of my friends suggested that I generate my CSS using Javascript, primarily for the significant decrease in file size. The file size would decrease in the following two cases:
The columns classes look something like
col-x-12, and JS would be able to calculate the widths and write the column classes using much less code.I would be able to map CSS attributes in JS (
bgforbackground, for example), thus also reducing file size.
The generated CSS could directly be inserted into the head or added to the CSSStyleSheet.
Apart from the little overhead caused by running the JS, what other problems may this approach cause?