JSFiddle - React, Tailwind, and code Playground
by kritzikratzi
HTML
<style type="text/less">
@color: green;
#header{
color: @color;
}
</style>
<div id="header">i'm the header!</div>
<a href="#" onclick="less.Override('@color', 'red');">make me red</a>
<a href="#" onclick="less.Override('@color', 'rgb(0,0,255)');">make me blue</a>
<a href="#" onclick="less.Override('@color', '#ffff00');">make me yellow</a>
JavaScript
//
// LESS - Leaner CSS v1.3.0
// http://lesscss.org
//
// Copyright (c) 2009-2011, Alexis Sellier
// Licensed under the Apache 2.0 License.
//
// Modified by Hansi Raber (2012),
// all changes are marked with ---PATCH
(function (window, undefined) {
//
// Stub out `require` in the browser
//
function require(arg) {
return window.less[arg.split('/')[1]];
};
// amd.js
//
// Define Less as an AMD module.
if (typeof define === "function" && define.amd) {
define("less", [], function () { return less; } );
}
// ecma-5.js
//
// -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License
// -- tlrobinson Tom Robinson
// dantman Daniel Friesen
//
// Array
//
if (!Array.isArray) {
Array.isArray = function(obj) {
return Object.prototype.toString.call(obj) === "[object Array]" ||
(obj instanceof Array);
};
}
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(block, thisObject) {
var len = this.length >>> 0;
for (var i = 0; i < len; i++) {
if (i in this) {
block.call(thisObject, this[i], i, this);
}
}
};
}
if (!Array.prototype.map) {
Array.prototype.map = function(fun /*, thisp*/) {
var len = this.length >>> 0;
var res = new Array(len);
var thisp = arguments[1];
for (var i = 0; i < len; i++) {
if (i in this) {
res[i] = fun.call(thisp, this[i], i, this);
}
}
return res;
};
}
if (!Array.prototype.filter) {
Array.prototype.filter = function (block /*, thisp */) {
var values = [];
var thisp = arguments[1];
for (var i = 0; i < this.length; i++) {
if (block.call(thisp, this[i])) {
values.push(this[i]);
}
}
return values;
};
}
if (!Array.prototype.reduce) {
Array.prototype.reduce = function(fun /*, initial*/) {
var len = this.length >>> 0;
var i =...