use template strings to prevent sourcemaps breaking the code

pull/811/head
Rich Harris 7 years ago
parent f5f35b5a50
commit 71bd8e3008

@ -151,7 +151,7 @@ export default function dom(
const anchor = generator.customElement ? `null` : `options.anchor || null`;
const constructorBody = deindent`
${options.dev &&
${options.dev && !generator.customElement &&
`if ( !options || (!options.target && !options._root) ) throw new Error( "'target' is a required option" );`}
this.options = options;
${generator.usesRefs && `this.refs = {};`}
@ -186,7 +186,7 @@ export default function dom(
${generator.customElement ?
deindent`
this.attachShadow({ mode: 'open' });
${css && `this.shadowRoot.innerHTML = '<style>${options.dev ? `${css}\n/*# sourceMappingURL=${cssMap.toUrl()} */` : css}</style>';`}
${css && `this.shadowRoot.innerHTML = \`<style>${options.dev ? `${css}\n/*# sourceMappingURL=${cssMap.toUrl()} */` : css}</style>\`;`}
` :
(generator.stylesheet.hasStyles && options.css !== false &&
`if ( !document.getElementById( '${generator.stylesheet.id}-style' ) ) @add_css();`)

Loading…
Cancel
Save