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

atomizify

v1.1.2

Published

A JavaScript library generating atomic CSS classes and variables

Downloads

7

Readme

atomizify

atomizify is a small JavaScript library that generates a bunch of atomic CSS classes.

How to get it ?

Install the module in your folder:

npm i atomizify

Import it in your file:

import { atomizify } from 'atomizify'

How to use it ?

atomizify can fit all types of developers, from lazy to geekiest ones! It provides a few options to play with it: set some filters, choose your typecase system, or add your own custom classes.

Choose the profile that suits you the best:

  • You're a ready-made lover: by default, atomizify offers thousands of predefined classes. Just call the function, and a whole galaxy of CSS classes appears.

    atomizify()
  • You're a less-is-more expert: atomizify lets you select / unselect the classes of your choice among the predefined sets & generate only the substancial ones.

    // you can pass the 'filters' object, which accepts 3 sub-objects: 'sets', 'subsets', 'properties'
    // each sub-object accepts 2 key-value pairs: 'names' and 'to_remove'
    
    atomizify({
      filters: {
        sets: {
          names: ['layout'], // 'names' is an array containing the names of the targetted items (to keep, or to remove if the prop 'to_remove' is passed to 'true')
        },
        subsets: {
          names: ['dimensions'],
        },
        properties: {
          names: ['min-height', 'min-width'],
          to_remove: true, // set to 'true' if you want to remove the targetted items listed in 'names'
        },
      },
    })
  • You're a custom-all freak: atomizify gives you complete freedom to create and add your own custom classes. You can also personalize the typecase system for your classes' names.

    // you can pass the 'custom_classes' object, in which each entry is a key-value pair:
    // the key as the desired class name, and the string value as the desired CSS rule
    // you can also set the 'typecase' string value to choose the formatting of your classes' names
    
    atomizify({
      typecase: 'dash', // choose among 'snake', 'dash' or 'camel' case ; default is 'snake'
      custom_classes: {
        myclass1: 'background: black; color: turquoise',
        myclass2: 'border-color: pink',
        myclass3: 'font-size: 200px',
      },
    })

atomizify also works with React: it allows you to convert all the generated atomic classes in elegant-as-hell flags, that you can comfortably use & combine to build modular components ; and all of this thanks to kigiri. To achieve that, you'll have to install his invaluable dallas module as well:

npm i dallas

All set? Now, you can import the flagify function in your React app, and make an unwise use of the Component magic:

import { flagify } from 'atomizify'

const { Component } = flagify()

// chain the 'Component' object to every CSS classes you want to apply to your element,
// and finish by calling the type of HTML element you aim to render (div, span, section, input, etc.)
const Title = Component.fs55.sapphire3.mb40.div()

const App = () => <Title>atomizify</Title> // then use it as any React component

How to document it ?

atomizify also provides some ready-to-use generated documentation, so you can see at a glance all the magnificent CSS classes that have been generated.

Import & call the desired function(s) in your file:

  • If you'd like to display the CSS code generated, be my guest:
import { display_classes } from 'atomizify/doc'

// the 'display_classes' function can be called without argument
// it also accepts the following options, passed in an object: 'node', 'open', 'flattened'

display_classes({
  node: my_html_node, // you can pass a HTML node that will contain the chart ; default is 'document.body'
  open: false, // you can set the initial state of the component displaying the content ; default is 'true'
  flattened: false, // you can display the CSS classes all flattened, without the parents sections (sets, subsets and properties) ; default is 'false'
})

  • If you'd like to display a chart of the generated colors, suit yourself:
import { display_colors } from 'atomizify/doc'

// the 'display_colors' function can be called without argument
// it also accepts the following options, passed in an object: 'node', 'open', 'circles'

display_colors({
  node: my_html_node, // you can pass a HTML node that will contain the chart ; default is 'document.body'
  open: false, // you can set the initial state of the component displaying the content ; default is 'true'
  circles: false, // you can set the visual shape of the colors as circles ; default is 'false'
})

And voilà!