stoic
stoic

Reputation: 4830

Web host does not support .less file extension

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 make 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.

Upvotes: 1

Views: 3044

Answers (3)

stoic
stoic

Reputation: 4830

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.

Upvotes: 7

Drazisil
Drazisil

Reputation: 3343

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>

Upvotes: 3

numbers1311407
numbers1311407

Reputation: 34072

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.

Upvotes: 2

Related Questions