开发者

Which is better: SASS or dynamic css with aspx?

开发者 https://www.devze.com 2023-01-20 13:10 出处:网络
I have a doubt that came up to me just today. I\'ve read Sass website and tried a bit of things and I think it\'s great. Very flexible and powerful. However it was kind of a hassle when using it in Wi

I have a doubt that came up to me just today. I've read Sass website and tried a bit of things and I think it's great. Very flexible and powerful. However it was kind of a hassle when using it in Windows because I had to install Ruby, run the sass watch command everytime so it added more steps to my development environment. To me, the greatest advantage of Sass is maintanability because it allows you to factor and spread out changes in a very few s开发者_开发技巧teps. So I thought today that I could just use an asp file that returns its contentType = text/css and just use dynamic markup to get around, factorize, etc.

Something like:

<%
Response.ContentType = "text/css"
%>
<%
color = "#AAAAAA"
%>

fieldset {
  padding: 15px 10px 15px 10px;
  background-color: <%= color %>;
}

.FieldColumnLeft, .FieldColumnMiddle, .FieldColumnRight {
  float:left;
}

So my question (enough for the introduction) is, which one is better considering maintanability, flexibility, etc.? I know that the asp will hit the web server processor but with output caching I could just cache the output so the hit would be the first time only.

What do you think?


We had great experience with .less which is somewhat similar to SASS and the Chirpy Visual Studio plugin that works together with it. It creates the final css during compile and minifies and concatenates as well.

IMHO this is a much better solution then tinkering with dynamically created css and it also allows you to put the css files onto a CDN when speed is an issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消