Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix: Tailwind is not included in production builds #3

Merged
merged 1 commit into from Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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({});