Reputation: 9668
I am trying to setup a php LESS parser: less.php (https://github.com/oyejorge/less.php#basic-use).
I've written a basic code from the example:
<?php
require_once 'less.php/Less.php';
$parser = new Less_Parser();
$parser->parseFile( 'Z:\home\test1\www\assets\bootstrap\less\bootstrap.less', 'test' );
$css = $parser->getCss();
?>
that should compile the bootstrap.less file from the given folder. It works without error, however I am not sure where it saves the compiled css file? Can I specify its destination? Any help would be appreciated.
Upvotes: 0
Views: 116
Reputation: 5611
According to its documentation, getCss
does not save the CSS. In fact, the variable $css
will contain the CSS. To write the value of $css
to disk, use for example file_put_contents
. I.e:
<?php
require_once 'less.php/Less.php';
$parser = new Less_Parser();
$parser->parseFile( 'Z:\home\test1\www\assets\bootstrap\less\bootstrap.less', 'test' );
$css = $parser->getCss();
// And now to write the contents:
file_put_contents("output.css", $css);
?>
Upvotes: 2