LESS files not parsing when called using PJAX

86 Views Asked by At

I am using PJAX and LESS for my project. Pages called via PJAX has this code at the top

<link  href='the_less_file.less' rel="stylesheet/less" type="text/css" /> 
<script type="text/javascript" src="less-1.3.3.min.js"></script> 

This is supposed to parse the less files. Though it works perfectly fine when i am using normal ajax request. Is there any way to make this thing work with PJAX?

1

There are 1 best solutions below

1
On

less.js compiles your less code to css real time and client side. So to compile you will need a full page load.

From: http://pjax.heroku.com/:

Whenever the time changes, a full page load has happened. If the time doesn't change, no full page load has occurred.

So first compile your CSS first server side and PJAX - load your html with a link to your compiled CSS.