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

styled-component-template

v0.0.3

Published

A collection of templates to help create consistent, performant component styling for CSS and most major CSS preprocessors.

Downloads

5

Readme

Styled Component Template

A collection of templates to help create consistent, performant component styling for CSS and most major CSS preprocessors.

Comment Detail

The ordering of these is intentional. These groupings leverage the cascade to make the partials as efficient as possible.

The comments below link to the Sass partial for reference, but apply to every template.

  • 01 Provides an 80 character-wide column marker
  • 02 Category type: Layout, Object, Component, Theme, etc.
  • 03 This is the partial's name spelled out as a proper noun
  • 04 A link to the partial on a living styleguide, if available
  • 08 Use this comment block to provide any high level background information about the partial. Can span multiple lines, is constrained to an 80 character-long width. May be replaced with SassDoc
  • 13 Update to reflect the component's type and name. For example, a layout partial's class name would be called .l-sidebar
  • 14 Encapsulated logic prevents unpredictable behavior
  • 15 Variables can be used for all subsequent logic
  • 19 Use extends with a healthy dose of discretion
  • 21 Group properties alphabetically by intent. Use an empty space between each property grouping for easier scanning
  • 26 cursor, transition, etc.
  • 28 Pseudo classes can inform pseudo elements, therefore they come first
  • 37 Use HTML (ex: [hidden]) and ARIA (ex: [aria-busy="true"]) attributes to provide meaningful, semantic states
  • 39 Use Sass' ampersand selector to modify the partial's presentation based on a class declared higher up in the DOM. This is useful for theming and modifying behavior based on state. Ex: .t-dark & { … }
  • 42 Although @supports is technically not a media query, it is very similar behavior-wise
  • 43 Feature queries include Reduced Motion, High Contrast Mode, etc.
  • 44 Be sure to develop partials mobile first. I find a library like mappy-breakpoints helps to manage breakpoints and tweakpoints. After declaring a breakpoint, be sure to follow this template's ordering within the breakpoint
  • 46 Sass' ampersand selector works really well with a BEM naming methodology. Be sure be sure to follow this template's ordering within the nested selectors. Try not to nest selectors more than 3 deep—if you find yourself doing so, you can probably refactor

Notes

  • I prefer to use a comment as a subsection heading. I find it helps making scanning the file easier