[6a3a178] | 1 | "use strict";
|
---|
| 2 | /**
|
---|
| 3 | * Kicks off less and compiles any stylesheets
|
---|
| 4 | * used in the browser distributed version of less
|
---|
| 5 | * to kick-start less using the browser api
|
---|
| 6 | */
|
---|
| 7 | /* global window, document */
|
---|
| 8 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 9 | var tslib_1 = require("tslib");
|
---|
| 10 | var default_options_1 = tslib_1.__importDefault(require("../less/default-options"));
|
---|
| 11 | var add_default_options_1 = tslib_1.__importDefault(require("./add-default-options"));
|
---|
| 12 | var index_1 = tslib_1.__importDefault(require("./index"));
|
---|
| 13 | var options = default_options_1.default();
|
---|
| 14 | if (window.less) {
|
---|
| 15 | for (var key in window.less) {
|
---|
| 16 | if (window.less.hasOwnProperty(key)) {
|
---|
| 17 | options[key] = window.less[key];
|
---|
| 18 | }
|
---|
| 19 | }
|
---|
| 20 | }
|
---|
| 21 | add_default_options_1.default(window, options);
|
---|
| 22 | options.plugins = options.plugins || [];
|
---|
| 23 | if (window.LESS_PLUGINS) {
|
---|
| 24 | options.plugins = options.plugins.concat(window.LESS_PLUGINS);
|
---|
| 25 | }
|
---|
| 26 | var less = index_1.default(window, options);
|
---|
| 27 | exports.default = less;
|
---|
| 28 | window.less = less;
|
---|
| 29 | var css;
|
---|
| 30 | var head;
|
---|
| 31 | var style;
|
---|
| 32 | // Always restore page visibility
|
---|
| 33 | function resolveOrReject(data) {
|
---|
| 34 | if (data.filename) {
|
---|
| 35 | console.warn(data);
|
---|
| 36 | }
|
---|
| 37 | if (!options.async) {
|
---|
| 38 | head.removeChild(style);
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 | if (options.onReady) {
|
---|
| 42 | if (/!watch/.test(window.location.hash)) {
|
---|
| 43 | less.watch();
|
---|
| 44 | }
|
---|
| 45 | // Simulate synchronous stylesheet loading by hiding page rendering
|
---|
| 46 | if (!options.async) {
|
---|
| 47 | css = 'body { display: none !important }';
|
---|
| 48 | head = document.head || document.getElementsByTagName('head')[0];
|
---|
| 49 | style = document.createElement('style');
|
---|
| 50 | style.type = 'text/css';
|
---|
| 51 | if (style.styleSheet) {
|
---|
| 52 | style.styleSheet.cssText = css;
|
---|
| 53 | }
|
---|
| 54 | else {
|
---|
| 55 | style.appendChild(document.createTextNode(css));
|
---|
| 56 | }
|
---|
| 57 | head.appendChild(style);
|
---|
| 58 | }
|
---|
| 59 | less.registerStylesheetsImmediately();
|
---|
| 60 | less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject);
|
---|
| 61 | }
|
---|
| 62 | //# sourceMappingURL=bootstrap.js.map |
---|