npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tacss

v0.0.7

Published

Type-Assisted CSS

Downloads

21

Readme

TACSS - Type-Assisted CSS (pronounced "tax")

* Currently designed for React. Looking to expand out to vanilla and other framework usage


TODO: Show basic tacssBracket example for pure React client-only apps

TODO: Show easy implementation of tacssReturn in SSR + hydrate scenarios (Next.js as easy example)


Shoutouts:

I was about 85% done with the first working version of TACSS when I happened to stumble onto the vanilla-extract package. At first I was a bit discouraged to keep working on this package. It looked like "Oh, guess someone else has already built this and they did a fantastic job even down to the docs".

  • We both treat the style definitions like the pure data they are, represented by plain-ol' javascript objects.
  • We both love the power of having TypeScript help avoid mistakes instead of spending time out in Unregulated String Land™, then spending 45 minutes cursing the heavens on why your style isn't applying the way it should, only to realize you missed a capital letter somewhere.
  • We both love keeping styles easily locally-scoped so you can really lean into a component-style architecture (even down to media-queries)

But I looked further and realized their intended use case and audience is actually different.

Main difference is they want to purely pre-process CSS creation (as they describe it, like using something such as SASS but with TypeScript powering it instead) and generate a .css file output at build time, where as TACSS specifically wants to generate at runtime.

My intent is to build "in-line styles but with the full power of media queries, pseudo-classes, etc.".

The focus is on very fast implementation: specifically no pre-process steps or setup, no having to import a variable for every new css class created, but instead just import a function or two and it just * works *.

The use-at-runtime approach also allows for the easy adaptability of styles based on other data available to your component (through props or network calls, anything) e.g.:

const result = await fetch("someapi.com/resource").then(r => r.json());
const style = {
    fontSize: 20,
    color: result.memberStatus.vip ? "purple" : "black"
}

Rather than having to create arbitrary CSS classes to add and remove from the dom element according to that data (which also implies you have to chooose a baseline style and then change the style after the data is available, which can cause flashes of undesired style).

This is simply a development choice and tradeoff. Many times, the pre-built CSS is plenty suitable and the no runtime costs are far more important. But sometimes the DX, or the flexibility of on-the-fly style generation is more valuable and the runtime costs are negligible.


Anyway! I wanted to give a shout out to the vanilla-extract team because I was able to refine a lot of little pieces (and improve my deeper CSS and styling knowledge) after looking through their great documentation, and those little boosts really add up! Thanks vanilla-extract team 😎