Cookie Consent by Free Privacy Policy Generator Aktuallisiere deine Cookie Einstellungen ๐Ÿ“Œ Lit, Web Components & TailwindCSS (Day 5) - Creating a SaaS Startup in 30 Days


๐Ÿ“š Lit, Web Components & TailwindCSS (Day 5) - Creating a SaaS Startup in 30 Days


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

While digging around for what tech-stack to use for the frontend, I stumbled upon Lit. Lit is a web components library with a minimal footprint just under 6kb, specifically designed to simplify your workflow as it has almost a 0 learning curve.

I am not going to argue whether it is better than React or any other frontend library, but I am going to confidently explain all the reasons I decided to go with it.

Easy Setup

I have chosen Vite as my go-to hero, and with a simple command, I get a Lit project up and running. When I say Lit project, I mean just some vanilla JS; it does not differ that much from writing regular JavaScript.

pnpm create vite my-vue-app --template vue

In order for you to understand just have a look at my project dependencies. As you can see I only need one package installed. This was a game-changer for me because I was tired of spending time setting up my development environment and having to install 10 packages to just have my project running.

  "dependencies": {
    "lit": "^3.1.2"
  }

JSX

Web Components don't use JSX; you just write old-fashioned vanilla HTML and use default ECMAScript features like Template literals. I never understood why we need to abstract basic things like HTML.

One more reason Web Components are so powerful is that Javascript is trash in general, so the less Javascript you use, the better for you. When I say trash, I don't mean the language but the fact that the JS ecosystem is completely bloated with useless abstractions and packages you don't really need.

    render() {
        return html`
          <button class="bg-gray-950 text-white capitalize py-3 px-7 rounded-lg flex gap-2 text-sm items-center">
            ${this.startText} <span class="block border-2 border-amber-500 font-bold w-6 h-6 rounded-md">${this.key}</span> ${this.endText}
          </button>
        `
    }

Powerful

Lit can be powerful as well. If you need global state management with lit-element-state you can have just than. Also lifecycle methods exist just like react for element mount or update etc.

You should have a look at the Lit docs the are super-simple to understand.

Classes

Some might consider this a downside, but it isn't. Almost every developer uses classes on the backend, and if you want to apply functionality on the front, it is not a bad choice to use them, and you shouldn't be afraid of them at all.

Here is a custom button element. It is simple to understand and reusable.

Javascript is an OOP language; wanting to make it functional by adding 100 abstractions to our code doesn't make it better. It adds a learning curve, makes it harder to maintain, and harder to update.

import {LitElement, html, css, unsafeCSS} from 'lit'
import styles from '../index.css?inline'

export class CtoButton extends LitElement {
    static styles = css`${unsafeCSS(styles)}`;
    static properties = {
        startText: { type: String },
        endText: { type: String },
        key: { type: String },
    }

    constructor() {
        super()
        this.startText = 'PRESS'
        this.endText = 'TO GET YOURS'
        this.key = 'A'
    }

    render() {
        return html`
          <button class="bg-gray-950 text-white capitalize py-3 px-7 rounded-lg flex gap-2 text-sm items-center">
            ${this.startText} <span class="block border-2 border-amber-500 font-bold w-6 h-6 rounded-md">${this.key}</span> ${this.endText}
          </button>
        `
    }


}

customElements.define('cto-button', CtoButton)

Future Proof

Next.js just released App Router; it completely changes the way routing works. Now, when you search for docs, you find something that works with Page Router, but with App Router, it breaks.

That gives web components a powerful advantage; you don't have to worry about any big update that is going to complicate the way you work even more.

Web Components are native web features that are robust and stable, and they are going to stay like that.

Should you use them for your project ?

A few years ago, you could argue that web components had problems with SEO, performance, or browser compatibility, but this is a thing of the past. Google and Bing can crawl your website just fine, and their bots can run JavaScript as well.

For the 0.01% that uses Windows XP in 2024, I don't want you to use my website anyway.

Moving away from React, Next.js, or Vue for simple applications should be a no-brainer. Writing pure code with no learning curve at all allows us to utilize JavaScript and HTML's full features. I think that JavaScript, in the long run, should become a single entity that developers use only to create frontend applications, and with web components, it is heading that way.

So YES, if you want an answer use them for your next project and don't loose yourself on the framework chaos.

Final Words

In conclusion, embracing Lit and Web Components for your SaaS startup offers a streamlined, efficient approach to building your frontend. By leveraging these tools, you minimize dependency overhead and focus on pure, robust web development practices.

This choice not only simplifies the development process but also ensures your application remains lightweight and future-proof.

Thanks for reading, and I hope you found this article helpful. If you have any questions, feel free to email me at [email protected], and I will respond.

You can also keep up with my latest updates by checking out my X here: x.com/sotergreco

...



๐Ÿ“Œ Sharkoon RGB Lit 100 & Lit 200: Hinter Frontglas warten Leuchtmuster


๐Ÿ“ˆ 45.16 Punkte

๐Ÿ“Œ JerryScript 1.0 lit/lit-char-helpers.c lit_read_code_unit_from_hex Pufferรผberlauf


๐Ÿ“ˆ 43.06 Punkte

๐Ÿ“Œ JerryScript 1.0 lit/lit-char-helpers.c lit_read_code_unit_from_hex memory corruption


๐Ÿ“ˆ 43.06 Punkte

๐Ÿ“Œ 'Create-react-tailwindcss ' an npm package to setup react-tailwindcss configuration


๐Ÿ“ˆ 37.12 Punkte

๐Ÿ“Œ Boost Your Tailwindcss Development with Flow Launcher's Tailwindcss Docs Extension


๐Ÿ“ˆ 37.12 Punkte

๐Ÿ“Œ Using Lit Components in an Enhance App


๐Ÿ“ˆ 32.19 Punkte

๐Ÿ“Œ Converting Lit Components to Enhance


๐Ÿ“ˆ 32.19 Punkte

๐Ÿ“Œ Tailwindcss in Styled-Components


๐Ÿ“ˆ 29.23 Punkte

๐Ÿ“Œ t3n Daily: Adobe &amp;amp; Figma, Ethereum &amp;amp; NFT, Steuer &amp;amp; Homeoffice, KI &amp;amp; Gruselfrau


๐Ÿ“ˆ 25.19 Punkte

๐Ÿ“Œ Lightning Web Components: Custom Nested Components


๐Ÿ“ˆ 24.9 Punkte

๐Ÿ“Œ Building a Web Scraper with React.js, Express and TailwindCSS: A Journey into Data Collection


๐Ÿ“ˆ 22.13 Punkte

๐Ÿ“Œ SvelteKit & TailwindCSS Tutorial โ€“ Build & Deploy a Web Portfolio


๐Ÿ“ˆ 22.13 Punkte

๐Ÿ“Œ ๐ŸŽ‰๐ŸŽ‰ Build and Deploy a Fullstack Hotel Booking Web App: Next.js 14, React.js, TS, TailwindCSS, Prisma


๐Ÿ“ˆ 22.13 Punkte

๐Ÿ“Œ How SaaS Sprawl, Inaccurate Data Fuel SaaS Management Issues


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Anomali Launches Differentiated Cloud-Native XDR SaaS Solution with Support from AWS SaaS Factory


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ SaaS Alerts Secures $22M Investment from Insight Partners to Scale SaaS Security Monitoring and Response Platform


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Modern SaaS Risks โ€“ CISOs Share Their SaaS Security Checklist


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Strengthen Your SaaS Security with SaaS Ops


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Setapp wins "Best SaaS Product for Productivity" in 2019 SaaS Awards


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ How to Build a SaaS on AWS: a deep dive into the architecture of a SaaS product


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ DoControl's 2023 SaaS Security Threat Landscape Report Finds Enterprises and Mid-Market Organizations Have Exposed Public SaaS Assets


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Check Point kรผndigt die allgemeine Verfรผgbarkeit von CloudGuard SaaS gegen Sicherheitsbedrohungen fรผr SaaS-Anwendungen an


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ You don't need to pay for SaaS boilerplates - Open SaaS


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ What is SaaS Sprawl? Guide to Combating SaaS Security Risks


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Validate Your SaaS Idea with MVP: A Crucial Step in SaaS MVP Development


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Zerto Backup for SaaS powered by Keepit, manages and protects cloud SaaS data


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Augmentt Engage optimizes SaaS management and SaaS security for MSPs


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ SaaS oder nicht SaaS, das ist hier die Frage


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Adaptive Shield reduces supply chain risks with SaaS-to-SaaS capabilities


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ AWS launches SaaS Quick Launch for easier deployment of SaaS apps


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ SaaS Asset and User Numbers are Exploding: Is SaaS Data Security Keeping Up?


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Launch your SaaS faster with OneMix by SaaS King


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ What is SaaS? How to Plan, Build, and Launch Your Own SaaS


๐Ÿ“ˆ 21.96 Punkte

๐Ÿ“Œ Netskope introduces SaaS security enhancements to Netskope One for GenAI and SaaS collaboration


๐Ÿ“ˆ 21.96 Punkte











matomo