kopia lustrzana https://github.com/c9/core
load lesslib when required
rodzic
3f15f233a4
commit
41286270b1
|
@ -9,8 +9,6 @@ define(function(require, module, exports) {
|
||||||
var settings;
|
var settings;
|
||||||
|
|
||||||
var packed = require("text!./style.less").length === 0;
|
var packed = require("text!./style.less").length === 0;
|
||||||
var less = require("./lib_less1.5");
|
|
||||||
if (less) less.async = true;
|
|
||||||
var packedThemes = packed || options.packedThemes !== false;
|
var packedThemes = packed || options.packedThemes !== false;
|
||||||
|
|
||||||
/***** Initialization *****/
|
/***** Initialization *****/
|
||||||
|
@ -167,28 +165,30 @@ define(function(require, module, exports) {
|
||||||
throw new Error("Can't add dynamic less library in packed mode!");
|
throw new Error("Can't add dynamic less library in packed mode!");
|
||||||
if (packedThemes) return;
|
if (packedThemes) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use dynamic require because we don't want this in the packed version
|
// use dynamic require because we don't want this in the packed version
|
||||||
var parser = new less.Parser({
|
require(["./lib_less1.5"], function(less) {
|
||||||
filename: filename
|
if (less) less.async = true;
|
||||||
});
|
var parser = new less.Parser({
|
||||||
|
filename: filename
|
||||||
// Parse Less Code
|
});
|
||||||
var baseLib = "@base-path : \"" + staticPrefix + "\";\n"
|
|
||||||
+ "@image-path : \"" + staticPrefix + "/images\";\n"
|
// Parse Less Code
|
||||||
+ "@icon-path : \"" + staticPrefix + "/icons\";\n";
|
var baseLib = "@base-path : \"" + staticPrefix + "\";\n"
|
||||||
|
+ "@image-path : \"" + staticPrefix + "/images\";\n"
|
||||||
var code = baseLib + "\n" + cssLibs.join("\n") + "\n" + css;
|
+ "@icon-path : \"" + staticPrefix + "/icons\";\n";
|
||||||
parser.parse(code, function (e, tree) {
|
|
||||||
if (e)
|
var code = baseLib + "\n" + cssLibs.join("\n") + "\n" + css;
|
||||||
return callback(e);
|
parser.parse(code, function (e, tree) {
|
||||||
|
if (e)
|
||||||
// Add css to the DOM
|
return callback(e);
|
||||||
var style = createStyleSheet(tree.toCSS({
|
|
||||||
relativeUrls: true,
|
// Add css to the DOM
|
||||||
rootpath: staticPrefix || ""
|
var style = createStyleSheet(tree.toCSS({
|
||||||
}));
|
relativeUrls: true,
|
||||||
callback(null, style);
|
rootpath: staticPrefix || ""
|
||||||
|
}));
|
||||||
|
callback(null, style);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue