@nx/rollup
Version:
56 lines (50 loc) • 1.44 kB
JavaScript
"use strict";
/**
* Inlined style-inject module
* Original: https://github.com/nicolo-ribaudo/style-inject
*
* This module is used at runtime to inject CSS into the DOM when
* the `inject` option is enabled and `extract` is disabled.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.STYLE_INJECT_PATH = exports.STYLE_INJECT_ID = exports.styleInjectCode = void 0;
/**
* The style-inject runtime code that gets injected into the bundle
* This is the ES module version that will be imported at runtime
*/
exports.styleInjectCode = `
function styleInject(css, ref) {
if (ref === void 0) ref = {};
var insertAt = ref.insertAt;
if (typeof document === 'undefined') {
return;
}
var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';
if (insertAt === 'top') {
if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
}
} else {
head.appendChild(style);
}
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}
export { styleInject };
export default styleInject;
`.trim();
/**
* Virtual module ID for style-inject
*/
exports.STYLE_INJECT_ID = '\0style-inject';
/**
* Path that will be used in imports
*/
exports.STYLE_INJECT_PATH = 'style-inject';