i'm trying compile small less
portion of code , mixing bigger 1 compiled in page.
i thought there way reuse compiled less or maybe load again, mix newer code , compile mixed in page.
i thought load in way example below:
var runtime_less = '@bg:red; .selector { background-color:@bg; }'; var library_less = '@var:bla bla bla...'; var library_parser = new(less.parser)({ paths: ['.', './lib'], // specify search paths @import directives filename: 'css/full_library.less' // specify filename, better error messages }); frontsize_parser.parse('', function (e, tree) { library_less = tree; }); var runtime_parser = new(less.parser)({}); runtime_parser.parse(library_less, function (e, tree) { // should inside load event $("#container-style").text(library_less.tocss() + ' ' + tree.tocss()); });
does exist way current page loaded less file , treat in way?
or exist way load less
files , mix less
data string additional less
code?
with t.less containing:
@color: lightgreen;
you can use following code:
<link type="text/css" href="t.less" rel="stylesheet/less"> <script> less = { env: "development" }; </script> <script src="/less.js/dist/less.js"></script> <script> var tmp = less.parse; less.parse = function(input,option,callback) { tmp(input + ' h1 {color:@color;}',option,callback); } less.refreshstyles(); </script>
Comments
Post a Comment