Pawan
Pawan

Reputation: 32331

How can I compile LESS files within browser

I created code for switching themes using LESS functionality. Unfortunately the LESS files will not compile in browser. How can I compile LESS files within browser?

Upvotes: 14

Views: 10726

Answers (4)

user2327502
user2327502

Reputation: 191

Include less file in your html and use some server if u r using google chrome.

Upvotes: 2

JSAddict
JSAddict

Reputation: 12427

you have to use some web server like apache tomcat, uniform server UPX etc in order to compile less in IE. as @ie told include those files in your document before running it in localhost.

Upvotes: 1

Nathan Strutz
Nathan Strutz

Reputation: 8123

Check your web server. Many servers are not initially set up to handle serving LESS files. Specifically newer versions of IIS tend to block serving *.less and need to be configured to do so. You can see if this is happening by loading your LESS CSS file directly from your browser. The easiest way to do that from Firefox is to view your page source and click the link to your LESS file.

Upvotes: 0

ie.
ie.

Reputation: 6101

This is a piece of documentation:

Client-side usage

Link your .less stylesheets with the rel set to “stylesheet/less”:

<link rel="stylesheet/less" type="text/css" href="styles.less">

Then download less.js from the top of the page, and include it in the <head> element of your page, like so:

<script src="less.js" type="text/javascript"></script>

Make sure you include your stylesheets before the script.

So, you need to:

  1. place link tag before script tag
  2. set rel to “stylesheet/less”
  3. be aware of bug in chrome

Upvotes: 15

Related Questions