Coder Social home page Coder Social logo

yunsii / tagged-classnames-free Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 162 KB

Free to use tagged classnames, powered by clsx and tailwind-merge.

Home Page: https://tagged-classnames-free.vercel.app

License: MIT License

Shell 1.41% TypeScript 94.59% HTML 3.30% JavaScript 0.70%
classes classname classnames clsx css es6 tagged-template-literals tagged-templates tailwindcss taiwlind

tagged-classnames-free's Introduction

tagged-classnames-free

Free to use tagged classnames, powered by clsx and tailwind-merge.

NPM version Download monthly

Usage

import { cls, tw } from 'tagged-classnames-free'

const className = tw`mx-auto max-w-4xl`
const className = cls`
  w-24 h-24 md:w-48 md:h-auto md:rounded-none rounded-full mx-auto
  object-cover
`
const className = tw`text-lg ${moreClassName}`

VS Code Integration

// .vscode/settings.json
{
  'tailwindCSS.experimental.classRegex': [
    ['tw`((?:\\S|\\s)*?)`', "'([^']+)'"],
    'tw`((\\S|\\s)*?)`',
    ['cls`((?:\\S|\\s)*?)`', "'([^']+)'"],
    'cls`((\\S|\\s)*?)`',
  ],
}

Functions

Based on clsx, support inline comment. Free to use clsx supported expressions.

Based on cls, support inline comment. Merge Tailwind CSS classes without style conflicts by tailwind-merge.

Furthermore

Developer eXperience

Wrap/unwrap tagged classnames by functions or html tags at sometime is unavoidable, you must NOT want to indent/dedent manually.

Luckily, eslint-plugin-unicorn has a template-indent rule for us to auto indent/dedent.

Runtime performance

You might also worried about the package increase extra burdens to runtime performance? Don't worry. there is a plugin unplugin-polish-tagged-templates to optimize for you.

After enhanced by unplugin-polish-tagged-templates, feel free to use cls and tw tags.

Try overall features on Gitpod.

Build & Publish

  • npm run build
  • npx changeset
  • npx changeset version
  • git commit
  • npx changeset publish
  • git push --follow-tags

changeset prerelease doc

License

MIT License © 2023 Yuns

tagged-classnames-free's People

Contributors

yunsii avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

adonis0123

tagged-classnames-free's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.