|
|
@ -137,15 +137,15 @@ export default function dom(
|
|
|
|
if (generator.stylesheet.hasStyles && options.css !== false) {
|
|
|
|
if (generator.stylesheet.hasStyles && options.css !== false) {
|
|
|
|
const { css, cssMap } = generator.stylesheet.render(options.filename);
|
|
|
|
const { css, cssMap } = generator.stylesheet.render(options.filename);
|
|
|
|
|
|
|
|
|
|
|
|
const textContent = options.dev ?
|
|
|
|
const textContent = stringify(options.dev ?
|
|
|
|
`${css}\n/*# sourceMappingURL=${cssMap.toUrl()} */` :
|
|
|
|
`${css}\n/*# sourceMappingURL=${cssMap.toUrl()} */` :
|
|
|
|
css;
|
|
|
|
css);
|
|
|
|
|
|
|
|
|
|
|
|
builder.addBlock(deindent`
|
|
|
|
builder.addBlock(deindent`
|
|
|
|
function @add_css () {
|
|
|
|
function @add_css () {
|
|
|
|
var style = @createElement( 'style' );
|
|
|
|
var style = @createElement( 'style' );
|
|
|
|
style.id = '${generator.stylesheet.id}-style';
|
|
|
|
style.id = '${generator.stylesheet.id}-style';
|
|
|
|
style.textContent = ${JSON.stringify(textContent)};
|
|
|
|
style.textContent = ${textContent};
|
|
|
|
@appendNode( style, document.head );
|
|
|
|
@appendNode( style, document.head );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
`);
|
|
|
@ -263,8 +263,8 @@ export default function dom(
|
|
|
|
|
|
|
|
|
|
|
|
let result = builder
|
|
|
|
let result = builder
|
|
|
|
.toString()
|
|
|
|
.toString()
|
|
|
|
.replace(/(\\)?@(\w*)/g, (match: string, escaped: string, name: string) => {
|
|
|
|
.replace(/(\\\\)?@(\w*)/g, (match: string, escaped: string, name: string) => {
|
|
|
|
if (escaped) return match.slice(1);
|
|
|
|
if (escaped) return match.slice(2);
|
|
|
|
|
|
|
|
|
|
|
|
if (name in shared) {
|
|
|
|
if (name in shared) {
|
|
|
|
if (options.dev && `${name}Dev` in shared) name = `${name}Dev`;
|
|
|
|
if (options.dev && `${name}Dev` in shared) name = `${name}Dev`;
|
|
|
|