Last Updated: February 25, 2016
·
1.945K
· rizwaniqbal

Less Compile error with Laravel + Leafo + Basset

I have a project on Laravel that uses Bootstrap (via composer) and I recently moved to using [Basset by Jason Lewis][1]

When I tried building the basset collection application

dragonstone:rizwan$ php artisan basset:build application --force

I would get an error with mixins.

Starting development build...
Gathering assets for collection...




  [Exception]                                                                                   
  parse error: failed at `.size(@width; @height) {` myapp/vendor/twitter/bootstrap/less/mixins.less on line 47 

Now, I don't use the stock less compiler shipped with [Basset][1] and prefer using the PHP LESS Compiler by [Leafo][2].

The error as I figured was with the compiler not able to compile recursive mixin. However, the latest Leafo build, [v0.4.0 fixes][3] this and just pumping the version up in your composer.json should do the trick.

This is how my composer looks right now:

"require": {
    "laravel/framework": "4.0.*",
    "way/generators": "dev-master",
    "twitter/bootstrap": "dev-master",
    "jasonlewis/basset": "dev-master",
    "leafo/lessphp": "v0.4.0"
},

[1]: http://jasonlewis.me/code/basset/4.0/
[2]: http://leafo.net/lessphp/
[3]: http://leafo.net/lessphp/docs/#selector_expressions

2 Responses
Add your response

Hi Rizwan - I had the same problem today, and I updated lessphp, but I still get the error. Any more ideas on how to fix this?

composer update
...
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing leafo/lessphp (v0.3.9)
- Installing leafo/lessphp (v0.4.0)
Loading from cache
...

Composer looks happy to me, but... when I try to load my page, I still get:

parse error: failed at .size(@width; @height) { /myapp/public/assets/bootstrap-3.0.1/less/mixins.less on line 47

over 1 year ago ·

Looks like you have kept bootstrap in the public assets and are not loading it through composer. Can you try loading bootstrap through composer too.....

I am not really sure if that is the reason, but sounds legit to try once....

over 1 year ago ·