I am using lesscss.org's styles on my MVC application.
It works great, but unfortunately my web host does not support .less
file extensions, neither will they add support.
Seeing though LessCSS makes use of JavaScript, surely there must be a way to rename my CSS file from site.less to site.css and change the JavaScript to m开发者_运维技巧ake use of the .css extension instead of the .less extension.
Please note I am not using dotLess, and compiling prior to release is also not what I am looking for.
Finally got it working.
All i had to do is modify my web.config of my MVC web application and add the following:
<system.webServer>
...
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent>
</system.webServer>
I re-published the site to my hosting provider afrihost, and it wall worked perfectly.
The script appears to only be looking for the stylesheet/less
rel. As far as I can tell, the file extension doesn't matter.
To clarify, renaming styles.less to styles.css and using the following code should work:
<link rel="stylesheet/less" type="text/css" href="styles.css">
<script src="less.js" type="text/javascript"></script>
Simply convert to css locally before you upload it.
$ lessc styles.less > styles.css
From the usage page: http://lesscss.org/#-client-side-usage
You can pass -x
for minification.
精彩评论