lukeed/clsxPublic

A tiny (239B) utility for constructing `className` strings conditionally.

Alternative install methods to npm?

GE

Hello. First off, thanks a ton for this utility!

I just started off a tiny project that won't be using NodeJS, React, or any fancy frameworks; just plain old HTML. I am easily able to embed TailwindCSS as it has an offering without NodeJS. I didn't see a similar installation method for `clsx`; is this possible and/or planned? Or would it be simpler to just copy paste code from here to my project?

  1. SK

    May I ask why? npm/Yarn/pnpm are very well established and pretty much the defacto for installing dependencies. You'll have a hard time not using them for any package!

  2. GE
    Author

    It's because the project is too tiny for me to bother with frameworks, etc. The biggest and mostly only dependency I need is TailwindCSS which is already available to install in plain HTML.

    `clsx` is just a nice to have which is why I asked here. Even so, it doesn't justify adding `npm` or `nodejs` to my dependencies since I won't need any packages in the future either. If I do, then I'll most likely just switch out of plain HTML as well.

  3. SK

    In that case, have you tried using CDN's such as [unpkg](https://www.unpkg.com/)? You should be able to load `clsx` directly into HTML by adding

    ```html <script src="https://www.unpkg.com/clsx@2.1.0/dist/clsx.min.js"></script> ```

    to your page.

    Note: that should work for any npm package if you like that kind of work style.

  4. GE
    Author

    Oh well, that pretty much solves my problem neatly; thanks!

  5. GetPsychedclosed2 years ago on GitHub