Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

less 2.2.0 #232

Open
mhorvath opened this issue Jan 12, 2015 · 2 comments
Open

less 2.2.0 #232

mhorvath opened this issue Jan 12, 2015 · 2 comments

Comments

@mhorvath
Copy link

is there any plan to update the LessCss.php commands to Less 2.2.0?

@markstory
Copy link
Owner

We'd need to keep both less1 and less2, so it sounds like another filter would be needed.

@mrthan
Copy link

mrthan commented May 11, 2016

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)));
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants