jquery - How to insert LESS mixin in to JavaScript code -
is there option insert less mixin in js code?
i have border-radius mixin:
.border_radius(@radius: 5px) { border-radius: @radius; -moz-border-radius: @radius; -webkit-border-radius: @radius; }
so there possible add mixin in jquery code?
var less = require('less'); $('.circle').css({ width: width, height: width, less.border_radius(10px); });
you define javascript equivalent of less mixins require:
html
<div class="circle"></div>
css
.circle { border: 1px solid #ff0000; }
jquery
function border_radius(radius) { radius = radius || '5px'; return { 'border-radius': radius, '-moz-border-radius': radius, '-webkit-border-radius': radius } } var styles = border_radius(), width = '20px'; styles.width = width; styles.height = width; $('.circle').css(styles);
Comments
Post a Comment