asset_compress
asset_compress copied to clipboard
less 2.2.0
is there any plan to update the LessCss.php commands to Less 2.2.0?
We'd need to keep both less1 and less2, so it sounds like another filter would be needed.
Hi,
I'm just having a crack at this with Lessc 2.7.1, the existing LessCss.php filter just needs this _generateScript updated to use the new syntax.
I'm still using a LessPHP version which needs more ../ on includes, 3 to be exact. And Lessc doesn't want them, so this keeps the LESS compatible
$input = str_replace('../../../', '', $input);
protected function _generateScript($file, $input) {
//remove 3 ../ from here
//..\/..\/..\/..\/..\/ -> ..\/..\/
$input = str_replace('../../../', '', $input);
$text = <<<JS
var less = require('less'),
util = require('util');
var options = { paths: %s };
var lessInput = %s; //actual LESS code
less.render(lessInput, options)
.then(function(output) {
// output.css = string of css
// output.map = string of sourcemap
// output.imports = array of string filenames of the imports referenced
util.print(output.css);
process.exit(0);
},
function(error) {
less.writeError(error);
process.exit(1)
});
JS;
file_put_contents($file, sprintf($text, str_replace('\/*', '', json_encode($this->_settings['paths'])), json_encode($input)));
}