Skip to content
Permalink
Browse files

fix: Correct replacements of css.<key> values (#436)

  • Loading branch information...
tivac committed Jun 22, 2018
1 parent f413732 commit b4de3086ac8b4fcc43170de8c0337bfdc10cb224
@@ -17,12 +17,12 @@ function updateCss({ content, result }) {
code : content
// Replace simple {css.<key>} values first
.replace(
new RegExp(`{css.(${Object.keys(exported).join("|")})}`, "gm"),
new RegExp(`{css\\.(${Object.keys(exported).join("|")})}`, "gm"),
(match, key) => exported[key].join(" ")
)
// Then any remaining bare css.<key> values
.replace(
new RegExp(`(\\b)css.(${Object.keys(exported).join("|")})(\\b)`, "gm"),
new RegExp(`(\\b)css\\.(${Object.keys(exported).join("|")})(\\b)`, "gm"),
(match, prefix, key, suffix) => `${prefix}"${exported[key].join(" ")}"${suffix}`
)
};

This file was deleted.

Oops, something went wrong.
@@ -15,7 +15,15 @@ exports[`/svelte.js should extract CSS from a <link> tag (existing script) 1`] =
export default {
data : () => ({
bool : true
})
}),

oncreate() {
const bd = {
flex : \\"flex\\"
};

const style = css[bd.flex];
}
};</script>
"
`;
@@ -11,6 +11,14 @@ <h1 class="{css.hd}">Head</h1>
export default {
data : () => ({
bool : true
})
}),
oncreate() {
const bd = {
flex : "flex"
};
const style = css[bd.flex];
}
};
</script>

0 comments on commit b4de308

Please sign in to comment.
You can’t perform that action at this time.