0

I'm using lessphp (v0.4.0) with codeigniter Sparks which is working ok apart from when I try to use variables.

For example if I put:

@blah:#123456;

At the top of my .less file it bombs out with:

   Fatal error: Uncaught exception 'Exception' with message 'parse error: failed at `@blah:#123456; ` line: 2' in
...\assets\lessc.php:3256 Stack trace: #0
...\assets\lessc.php(2130): lessc_parser->throwError() #1
...\assets\lessc.php(1651): lessc_parser->parse('????@blah:#1234...') #2
...\assets\lessc.php(1791): lessc->compile('????@blah:#1234...') #3
...\assets.php(437): lessc->parse('????@blah:#1234...') #4
...\assets.php(88): Assets::_process('css') #5
...\layout.php(27): Assets::css(Array) #6 ...\Loader.php(833): include('...') in ...\lessc.php on line 3256

Remove the variable and all works fine. Has anyone else experienced this and found a solution?

DavidWainwright
  • 2,895
  • 1
  • 27
  • 30

1 Answers1

1

Found a short-term solution to this. The error was being thrown if the first line of the .css file was anything BUT a css rule. So if I put:

a { }

@blah:#123456;

body {
    color:@blah;
}

It works fine. Really hope this helps someone out.

DavidWainwright
  • 2,895
  • 1
  • 27
  • 30