How do you use LESS with BlogEngine.net?

176 Views Asked by At

The LESS docs here

http://lesscss.org/#usage

say: "Make sure you include your stylesheets before the script."

However, BlogEngine.net seems to make that impossible by rewriting all the links to *.js file and putting them before the style sheets.

I've tried everything I can think of including putting the files in a subdirectory and using a relative path. I'm very hesitant to mess with the BlogEngine.Net code.

Is there any way to get LESS to work with CSS in BlogEngine.Net? Any way to force the engine to allow me to order the Javascript entry after the *.less reference?

2

There are 2 best solutions below

0
On

Perhaps you could use the Tracking Script or the "Add custom code to the HTML head section" fields (you can find them in Admin -> Settings -> Custom code).

From what I can see in the code, these fields are rendered in the HEAD section after the stylesheets.

0
On

Is there any way to get LESS to work with CSS in BlogEngine.Net?

If you are willing to consider a different approach than using the client side less parser than I recommend trying the design time less parser in either Visual Studio 2012.2 or The Web Essentials Extension in Prior releases of Visual Studio 2012. It allows you to write your less file and have it compiled to css and minified css every time you save. Then you can just reference the output min.css file in your theme.