Dynamic CSS with Razor (part 2)

added by hemme
2/9/2012 11:21:32 AM

3 Kicks, 442 Views

In PART ONE we saw how to create a gradient programmatically in order automate a CSS stylesheet using the Razor engine. We started from a base color in the RGB space and converted it to the HSL space. Given its Lightness we could easily build shades and highlights of the starting color.


2/9/2012 11:20:50 AM
It's an interesting approach, is the benefit just that you don't need an external compiler for less?

2/9/2012 1:48:17 PM
Yes, this is surely a benefit. Another one is to factorize and leverage your knowledge about one - powerful - programming language (Razor in this case) instead of studying new techniques/languages: too much effort for covering just a little portion of a web project.