Skip to content

Figure out the best way to have "components" and reusable styles #1

Open
@scotttrinh

Description

@scotttrinh

TailwindCSS has a directive called @apply that takes a list of utility classes and generates the CSS that it would output, so you can use a class. You can see it here:

.kdl-section {
@apply py-10 px-2 md:px-4 prose prose-xl mx-auto;
}

However, I've heard that it is discouraged, and using the template language's component abstraction is better. Since we're using HTML (and Liquid) here, there isn't a place that is obvious to me for this component abstraction. There is Web Components, and full-fledged UI libraries like React/Vue/etc, but that all seems overkill.

For now, seems like @apply does the trick, but I wanted to open this question up to in case someone has some experience in this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions