Skip to content

Commit

Permalink
Merge pull request #3 from Mafrans/fix/fix-css-imports
Browse files Browse the repository at this point in the history
Hotfix: Tailwind is not included in production builds
  • Loading branch information
Mafrans committed Apr 6, 2022
2 parents f52ba21 + fd77a6d commit f445e49
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
node_modules
yarn-error.log
yarn-error.log
dist
1 change: 1 addition & 0 deletions index.html
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./src/styles/main.css" />
<title>Document</title>
</head>
<body>
Expand Down
1 change: 0 additions & 1 deletion src/pages/IndexPage.ts
Expand Up @@ -4,7 +4,6 @@ import { html, LitElement } from "lit";
import { customElement } from "lit/decorators.js";

import "../components/HelloWorld";
import "../styles/main.css";
import { TW } from "../util/TailwindMixin";

@customElement("x-index-page")
Expand Down
9 changes: 3 additions & 6 deletions src/util/TailwindMixin.ts
Expand Up @@ -3,11 +3,8 @@ export const TW = <T extends LitMixin>(superClass: T): T =>
connectedCallback() {
super.connectedCallback();

const link = document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";
link.href = new URL("../styles/main.css", import.meta.url).href;

this.shadowRoot.append(link);
document.head.querySelectorAll("link[rel='stylesheet']").forEach((link) => {
this.shadowRoot.append(link.cloneNode());
});
}
};
3 changes: 1 addition & 2 deletions vite.config.js
@@ -1,4 +1,3 @@
import { defineConfig } from 'vite';

defineConfig({
});
export default defineConfig({});

0 comments on commit f445e49

Please sign in to comment.