Merge branch 'less-less' into staging
This commit is contained in:
@@ -4,9 +4,11 @@ const define = (x:any, y:any) => {};
|
||||
const require = define;
|
||||
*/
|
||||
define([
|
||||
'/api/config'
|
||||
], function (Config) { /*::});module.exports = (function() {
|
||||
'/api/config',
|
||||
'/bower_components/nthen/index.js'
|
||||
], function (Config, nThen) { /*::});module.exports = (function() {
|
||||
const Config = (undefined:any);
|
||||
const nThen = require('/bower_components/nthen/index.js');
|
||||
*/
|
||||
|
||||
var module = { exports: {} };
|
||||
@@ -100,6 +102,10 @@ define([
|
||||
require(['/bower_components/less/dist/less.min.js'], function (Less) {
|
||||
if (lessEngine) { return void cb(lessEngine); }
|
||||
lessEngine = Less;
|
||||
Less.functions.functionRegistry.add('LessLoader_currentFile', function () {
|
||||
return new Less.tree.UnicodeDescriptor('"' +
|
||||
fixURL(this.currentFileInfo.filename) + '"');
|
||||
});
|
||||
var doXHR = lessEngine.FileManager.prototype.doXHR;
|
||||
lessEngine.FileManager.prototype.doXHR = function (url, type, callback, errback) {
|
||||
url = fixURL(url);
|
||||
@@ -133,24 +139,39 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.load = function (url /*:string*/, cb /*:()=>void*/) {
|
||||
var btime = +new Date();
|
||||
var loadSubmodulesAndInject = function (css, url, cb, stack) {
|
||||
inject(css, url);
|
||||
var nt = nThen;
|
||||
nt = nt(function (w) {
|
||||
css.replace(/\-\-LessLoader_require\:\s*"([^"]*)"\s*;/g, function (all, u) {
|
||||
u = u.replace(/\?.*$/, '');
|
||||
module.exports.load(u, w(), stack);
|
||||
});
|
||||
}).nThen;
|
||||
nt(function () { cb(); });
|
||||
};
|
||||
|
||||
module.exports.load = function (url /*:string*/, cb /*:()=>void*/, stack /*:?Array*/) {
|
||||
var btime = stack ? null : +new Date();
|
||||
stack = stack || [];
|
||||
if (stack.indexOf(url) > -1) { return void cb(); }
|
||||
var timeout = setTimeout(function () { console.log('failed', url); }, 10000);
|
||||
var done = function () {
|
||||
console.log("Compiling [" + url + "] took " + (+new Date() - btime) + "ms");
|
||||
clearTimeout(timeout);
|
||||
if (btime) {
|
||||
console.log("Compiling [" + url + "] took " + (+new Date() - btime) + "ms");
|
||||
}
|
||||
cb();
|
||||
};
|
||||
stack.push(url);
|
||||
cacheGet(url, function (css) {
|
||||
if (css) {
|
||||
inject(css, url);
|
||||
return void done();
|
||||
}
|
||||
if (css) { return void loadSubmodulesAndInject(css, url, done, stack); }
|
||||
console.log('CACHE MISS ' + url);
|
||||
((/\.less([\?\#].*)?$/.test(url)) ? loadLess : loadCSS)(url, function (err, css) {
|
||||
if (!css) { return void console.error(err); }
|
||||
var output = fixAllURLs(css, url);
|
||||
cachePut(url, output);
|
||||
inject(output, url);
|
||||
done();
|
||||
loadSubmodulesAndInject(output, url, done, stack);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
if (!document.querySelector("#alertifyCSS")) {
|
||||
// Prevent alertify from injecting CSS, we create our own in alertify.less.
|
||||
// see: https://github.com/alertifyjs/alertify.js/blob/v1.0.11/src/js/alertify.js#L414
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
var css = document.createElement("span");
|
||||
css.id = "alertifyCSS";
|
||||
css.setAttribute('data-but-why', 'see: common-interface.js');
|
||||
head.insertBefore(css, head.firstChild);
|
||||
}
|
||||
define([
|
||||
'jquery',
|
||||
'/customize/messages.js',
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
@import (once) '../customize/src/less2/include/colortheme-all.less';
|
||||
@import '../customize/src/less2/include/modal.less';
|
||||
@import (reference) '../customize/src/less2/include/colortheme-all.less';
|
||||
@import (reference) '../customize/src/less2/include/modal.less';
|
||||
|
||||
.fileDialog_main () {
|
||||
#fileDialog {
|
||||
.modal_main();
|
||||
display: none;
|
||||
.cp-modal {
|
||||
.fileContainer {
|
||||
|
||||
@@ -18,7 +18,6 @@ define([
|
||||
'/bower_components/file-saver/FileSaver.min.js',
|
||||
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
|
||||
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
||||
'less!/customize/src/less2/main.less',
|
||||
], function (
|
||||
$,
|
||||
Hyperjson,
|
||||
|
||||
Reference in New Issue
Block a user