Using math in calc on Less.js 3.0.0 (working)
https://stackoverflow.com/a/55168887/3840840
by Sebastian Brosch
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/3.0.0/less.min.js"></script>
<p class="test">Hello World</p>
CSS
@test: -0.05em;
.test {
border: 1px solid red;
padding-top: calc((@test * -1) + 1em);
}
/**
Less.js (version 3.0.0). The above code compiles to the following CSS:
.test {
border: 1px solid red;
padding-top: calc((-0.05em * -1) + 1em);
}
*/
JavaScript
/** https://stackoverflow.com/a/30699015/3840840 */
$('head style[type="text/css"]').attr('type','text/less');
less.env = 'development';
less.refreshStyles();