
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
butopen-web-components-tailwind-starter-kit
Advanced tools
This is a starter kit to develop web components using Tailwind CSS.
This is a starter kit to develop web components using Tailwind CSS.
Tailwind and web components do not play well together.
We managed to find a way to make them work without hacks or weird tech: just common technologies combined in a elegant way.
No dependencies, based on lit-element.
Here is a sample code:
import {html} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {TailwindElement} from '../shared/tailwind.element';
import style from './test.component.scss'; // #1
@customElement('test-component')
export class TestComponent extends TailwindElement(style) { // #2
@property()
name?: string = 'World';
render() {
return html`
<p>
Hello,
<b>${this.name}</b>
!
</p>
<button class="bg-blue-200 text-yellow-200 p-2 rounded-full text-2xl">Hello world!</button>
`;
}
}
It is based on the lit element technology: if you wrote a lit component before, you'll find it familiar.
There are only two differences to a standard LitElement:
A TailwindElement extends a LitElmement (see below) and adds the logic to integrate tailwind and your style.
To run the project:
pnpm install
(only the first time)pnpm start
to run the serverpnpm build
and copy the static assets where you need them.You may clone this repo and start developing your components by looking at the test.component as reference.
As an alternative, and if you like to have control over every piece, do the following:
That's all.
If you want to understand how it works, it's simple:
"autoprefixer": "^10.4.12",
"postcss": "^8.4.18",
"lit": "^2.4.0",
"tailwindcss": "^3.2.0",
"typescript": "^4.8.4",
"vite": "^3.1.8",
"sass": "^1.55.0"
import {LitElement, unsafeCSS} from "lit";
import style from "./tailwind.global.css";
const tailwindElement = unsafeCSS(style);
export const TailwindElement = (style) =>
class extends LitElement {
static styles = [tailwindElement, unsafeCSS(style)];
};
It extends a LitElement class at runtime and adds the component tailwind classes.
The style variable comes from your component, where it is imported from an external CSS (or SCSS) file.
Then it is combined with the default tailwind classes.
If you add more components, the common parts are reused.
We developed this starter kit to implement a web session player for our open source SaaS browserbot.
If you want to contribute or share soem thoughts, just get in touch with us.
Enjoy.
FAQs
This is a starter kit to develop web components using Tailwind CSS.
The npm package butopen-web-components-tailwind-starter-kit receives a total of 0 weekly downloads. As such, butopen-web-components-tailwind-starter-kit popularity was classified as not popular.
We found that butopen-web-components-tailwind-starter-kit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.