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 🙏

© 2026 – Pkg Stats / Ryan Hefner

simple-in-js

v1.0.1

Published

Simple css in js to build your components

Readme

simple-in-js

Simple css in js for developing component based js app

this simple script use object that has toString() method and proxy to server ability to extends classname dynamically

Usage/Examples

To used it import useCSS or css function inside index.js script. The output of useCSS template function is an proxy that reflect toString() method that returns a generated class name. The css method return a class name as string. This separation intended to avoid type conflict in typescript. You can also write nested style.

  const style = css`
  display: flex;

  a {
    color: red;
  }

`

Put it on className attribute:

  function App(){
    return (
      <div className={style}>
        <a>
          {//This link's color is red}
        </a>
      </div>
    )
  }

NOTE: Alway remember to call css or useCSS function outside the component so it won't redundantly insert multiple style. For further improvement, I will add cache to avoid this

with

In case you want to use tailwind, bootstrap, or just add class dynamically you can use property accessor for ex:

  const style = useCSS``;
  style.otherClass // or style['otherClass']

  // output: `${generatedClassname} otherClass`

or use the generated style with method:

  const style = useCSS``;
  style.with('container', 'box-border hidden');

  // output: `${generatedClassname} container box-border hidden`

or simply use @with rules:

  const style = css`
  display: flex
  @with flex flex-row items-start
`
  // you can use css or useCSS function for @with rules

  // output: `${generatedClassname} flex flex-row items-start`

at rules only cannot be use inside nested style.

composite style

Because the output of useCSS is an object that returns a proxy object: {with: () => string, name: string}. You can compose a style. For example:

  const flexContainer = useCSS`
    display: flex;
  `

  const alignCenter = css`
    align-items: center;
    @with ${flexContainer.name} justify-center
  `

  // or to dynamically compose style

  const center = css`
    align-items: center;
  `

  const start = css`
    align-items: start;
  `

  const end = css`
    align-items: end;
  `

  function App(){
    const state = useState('end');
    const [style, setStyle] = useState('');

    switch(state){
      case 'start':
        setStyle(flexContainer.with(start))
      break;
      case 'center':
        setStyle(flexContainer.with(center))
      break;
      case 'end':
        setStyle(flexContainer.with(end))
      break;
    }

    return (
      <div className={style}></div>
    )
  }

NOTE: the @with value won't included for now

Roadmap

  • [ ] Caching
  • [ ] Builder ‒Generate css file.
  • [ ] @tailwind, @bootstrap rules support
  • [ ] Include all value for composite style