fix some CSS stuff

pull/3539/head
Richard Harris 6 years ago
parent 59035c89d5
commit 2f7e67e019

@ -37,7 +37,13 @@ export default function dom(
const add_css = component.get_unique_name('add_css');
if (styles && component.compile_options.css !== false && !options.customElement) {
const should_add_css = (
!options.customElement &&
styles.length > 0 &&
options.css !== false
);
if (should_add_css) {
body.push(b`
function ${add_css}() {
var style = @element("style");
@ -65,14 +71,6 @@ export default function dom(
);
}
// TODO injecting CSS this way is kinda dirty. Maybe it should be an
// explicit opt-in, or something?
const should_add_css = (
!options.customElement &&
component.stylesheet.has_styles &&
options.css !== false
);
const uses_props = component.var_lookup.has('$$props');
const $$props = uses_props ? `$$new_props` : `$$props`;
const props = component.vars.filter(variable => !variable.module && variable.export_name);

@ -142,11 +142,11 @@ export default function ssr(
].filter(Boolean);
return b`
${css.code && b`
${css.code ? b`
const #css = {
code: "${css.code}",
map: ${css.map ? string_literal(css.map.toString()) : 'null'}
};`}
};` : null}
${component.extract_javascript(component.ast.module)}

Loading…
Cancel
Save