Sha256: e6823eaa13ab57eb4c2628b2dff829e625c29bd3e0ce520a883e4cf71aa187a2

Contents?: true

Size: 817 Bytes

Versions: 2

Compression:

Stored size: 817 Bytes

Contents

function render(source, options) {
	clearTimeout(compileTimer);
	var less = require('less-node/index');
	if(options.custom_functions) {
		var customFunctions = require(options.custom_functions);
		customFunctions.registerCustomFunctions(less, less.functions.functionRegistry);
	}
	try {
		less.render(source, options, callback)
	} catch(err) {
		callback(err);
	}
}

//
// Bit of a hack, our custom runner doesn't generate status until the callback is
// called, but ExecJS::ExternalRuntime calls `exec` when given a source to compile
// and that fails if no status is received.
//
// So we setup a timeout to call the callback in this scenario, which calls to render
// clear to ensure that both the `compile` & `call` work without modifications
// to ExecJS behaviour
//
var compileTimer = setTimeout(callback, 1);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
less-execjs-2.6.0.4 lib/less/compiler.js
less-execjs-2.6.0.3 lib/less/compiler.js