Skip to content

Commit

Permalink
fix: invalid css and css overlapping each other on different lib
Browse files Browse the repository at this point in the history
  • Loading branch information
si3nloong committed Feb 24, 2021
1 parent 3395c90 commit 895366a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/tooltip/src/Tooltip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
</span>

<style lang="scss">
$width: 6px;
.responsive-ui-tooltip {
position: absolute;
background: #3b3b3b;
Expand All @@ -157,8 +159,6 @@
opacity: 1;
z-index: 50;
$width: 6px;
&:after {
content: "";
position: absolute;
Expand Down
9 changes: 7 additions & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import sveltePreprocess from "svelte-preprocess";

const extractCss = () => {
const styles = {};
const order = [];
let order = [];
let changes = 0;

return {
Expand All @@ -35,7 +35,7 @@ const extractCss = () => {
// }
// }

code = code.replace(/.svelte\-[A-Z0-9]+/gi, "");
code = code.replace(/\.svelte\-[A-Z0-9]+/gi, "");

// Track the order that each stylesheet is imported.
if (!order.includes(id)) {
Expand All @@ -53,6 +53,7 @@ const extractCss = () => {
},
generateBundle(opts, bundle) {
// No stylesheet needed, only emit single css file
// console.log(opts.format);
if (opts.format !== "iife") {
return;
}
Expand All @@ -66,12 +67,16 @@ const extractCss = () => {
for (let x = 0; x < order.length; x++) {
const id = order[x];
css += styles[id] || "";
styles[id] = ""; // reset style on every cycle
}

order = [];

// Don't create unwanted empty stylesheets
if (css.length == 0) {
return;
}

// // Emit styles through callback
// if (typeof options.output === 'function') {
// options.output(css, styles, bundle)
Expand Down

0 comments on commit 895366a

Please sign in to comment.