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

elr-scss-helpers

v0.0.12

Published

a scss mixin with some css helper classes

Downloads

8

Readme

elr-scss-helpers

Netlify Status License: MIT npm last commit

a library of sass mixins

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install elr-scss-helpers --save
yarn add elr-scss-helpers

Why

This package takes a more functional CSS approach to Scss. Using a Scss mixin allows for easy configuration of your base styles to ensure that your helpers will match the look and feel of your project.

Which style you choose can depend a lot on your project and your needs. A functional CSS approach is beneficial in situations where you have a lot of control over your HTML/JSX/Pug... whatever you're using to write markup that eventually becomes HTML. Especially if you are using a component based framework.

Keep in mind that adding non-semantic classes to your HTML will result in tightly coupled markup. If your product manager tells you that now all headlines should be green instead of blue using style classes could make these updates tedious and time consuming. Its for this reason that I will not include classes that apply hard coded color styles.

Using a more stylesheet based approach is useful when you don't necessarily have control over your HTML. Like when you're working with a CMS where HTML structure is set in stone or dictated by your content team.

Its also beneficial to use a more stylesheet based approach when you are creating traditional HTML/CSS based applications without a framework. If you are not creating reusable components you likely have a lot of HTML that repeats throughout your site. Using a stylesheet based approach with a BEM or similar CSS methodology will be much easier to maintain down the road.

I usually find myself using more of a hybrid of these 2 approaches. Though I'm leaning towards a more functional approach these days in my React and Vue applications.

Whats with this "elr" prefix?

I have added namespacing to avoid clashes with other frameworks. If you don't like the 'elr' prefix or want to use a brand prefix you are free to change it. Don't make it too long though since you'll be typing it a lot.

@include elr-helper-classes(
  $config: (
    prefix: 'abc'
  )
);
<button class="abc-button">Button</button>

Helper Classes

These classes allow for common styles.

Initialize Helpers

Parameters:

  • link-color
    • used for styling link elements
  • color
    • used for styling text
  • border-radius
    • used to style buttons
  • accent-color
  • button-color
    • used to style default buttons
@import '~elr-scss-helpers';

@include elr-helper-classes(
  $config: (
    link-color: blue,
    color: white,
    border-radius: 3px,
    accent-color: green,
    button-color: blue
  )
);

Buttons

if you only want to add button helpers

@import '~elr-scss-helpers';
@include elr-button-classes(
  $config: (
    background-color: blue,
    border-radius: 3px,
    width: 250px,
    color: white
  )
);
<button class="elr-button">Button</button>
<button class="elr-button-small">Button</button>
<button class="elr-button-primary">Button</button>
<button class="elr-button-pill">Button</button>
<button class="elr-button-ghost">Button</button>
<button class="elr-button elr-button-icon">
  <div class="elr-icon">
    <i class="fas fa-arrow-alt-circle-down"></i>
  </div>
  <span class="elr-button-text">Download</span>
</button>
<button class="elr-button elr-button-icon">
  <div class="elr-icon">
    <i class="fas fa-arrow-alt-circle-down"></i>
  </div>
</button>
<button class="elr-button elr-button-icon-round">
  <div class="elr-icon">
    <i class="fas fa-cat"></i>
  </div>
</button>

Button Group

<div class="elr-button-group">
  <button class="elr-button elr-button-primary elr-button-group-item">
    Button 1
  </button>
  <button class="elr-button elr-button-primary elr-button-group-item">
    Button 2
  </button>
  <button class="elr-button elr-button-primary elr-button-group-item">
    Button 3
  </button>
  <button class="elr-button elr-button-primary elr-button-group-item">
    Button 4
  </button>
</div>

Display

if you only want to add display classes. classes for display: flex and display: grid are included in other mixins.

@import '~elr-scss-helpers';
@include elr-display-classes;
<span class="elr-block">Block</span>
<div class="elr-inline">Inline</div>
<span class="elr-inline-block">Inline Block</span>
<span class="elr-display-none">This will be hidden</span>

Flex

if you only want to add flex classes

@import '~elr-scss-helpers';
@include elr-flex-classes;

Layout

if you only want to add layout classes

@import '~elr-scss-helpers';
@include elr-layout-classes;

Positioning

if you only want to add positioning classes

@import '~elr-scss-helpers';
@include elr-positioning-classes;

List

if you only want to add list classes

@import '~elr-scss-helpers';
@include elr-list-classes;

Responsive

if you only want to add responsive classes

@import '~elr-scss-helpers';
@include elr-responsive-classes;

Typography

if you only want to add typography classes

@import '~elr-scss-helpers';
@include elr-typography-classes;

Background

if you only want to add background classes

@import '~elr-scss-helpers';
@include elr-background-classes;

Action Helper Classes

These helper classes are more suited to interactive applications that need to provide a lot of feedback to viewers.

License

SEE LICENSE IN LICENSE.md