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

worko-mixins

v3.0.2

Published

Sass mixins to Worköholics dev team

Downloads

94

Readme

Worko Mixins

Author: Worköholics workoholics.es

Sass mixins to resolve common CSS functionalities. This package is dependency of other packages developed by Worköholics

You can import each mixin file independently or import _mixins.scss if you need all the mixins of the package.

Install

npm install --save worko-mixins

Usage

Import independently the file you need or import all mixins using _mixins.scss file.

// Enable mixins declared on transititons.scss
@import "./path/to/node_modules/worko-mixins/transitions.scss";
// Enable all mixins declared on the package
@import "./path/to/node_modules/worko-mixins/mixins.scss"

Files

  • _animations.scss: Mixins related with css animations

  • _grid.scss: Mixins related with elements of the grid: columns, rows, containers...

  • _media-queries: Mixins to manage css media queries and breakpoints

  • _transitions.scss: Mixins to manage css transitions

  • _utils: Mixins to solve different functionalities

  • _mixins.scss: Import this file to use mixins of all files described above

Animations

keyframes

Add css keyframes supported by all browsers

@include keyframes(animationName) {
  0% { transform: translateY(0) }
  100%{ transform: translateY(-50%)}
}

Media queries

Mixins to manage media queries

Default variables

You can override the default variables to manage your custom breakpoints.

$breakpoint-sm: 576px !default; 
$breakpoint-md: 768px !default;
$breakpoint-lg: 992px !default;
$breakpoint-xl: 1200px !default;

mq_sm

Mixin to declare styles on screens bigger than $breakpoint-sm

@include mq-sm {
  //your styles
}

mq_md

Mixin to declare styles on screens bigger than $breakpoint-md

@include mq-md {
  //your styles
}

mq_lg

Mixin to declare styles on screens bigger than $breakpoint-lg

@include mq-lg {
  //your styles
}

mq_xl

Mixin to declare styles on screens bigger than $breakpoint-xl

@include mq-xl {
  //your styles
}

mq($breakpoint)

Mixin to declare styles on screens bigger than the value passed as $breakpoint parameter

Parameters:

| Arguments | Description | | ------------- | ---------------------------------- | | $breakpoint | Value of the breakpoint in pixels |

@include mq(500px) {
  //your styles
}

Transitions

transition($args...)

Mixin to autoprefix transition property

Parameters:

| Arguments | Description | | ------------- | -------------------------- | | $args | List of transition values |

@include transition(opacity .35s ease-in-out, color .5 ease-in);

defaultTransition

Mixin to add the transition "all .35 ease-in-out" prefixed

@include defaultTransition;

Utils

prefixer($property, $value)

Mixin to auto-prefix properties

Parameters:

| Arguments | Description | | ------------- | -------------------------- | | $property | Property to auto-prefix | | $value | Value of the property |

@include prefixer(transform, translateY(-50%)); 

#### opacity($value)

| Arguments | Description | | ------------- | ----------------------------------------- | | $value | Value of the opacity property from 0 to 1 |

Mixin to set opacity to elements compatible with different browsers

@include opacity(0.2); 

Grid

Default variables

You can override the default variables to manage your custom properties.

$cols: 12 !default;
$gutter: 15px !default;
$safe-area: 90px !default;
$safe-area-xs: 30px !default;

getWidthByCols($c)

Function that returns the value of the column width in percentage

Parameters:

| Arguments | Description | | ------------- | ----------------------------------------- | | $c | Column quantity from 0 to $cols |

div {
  width: getWidthByCols(2);
}

getWidthByColsAndTotal($c, $total)

Function that returns the value of the column width in percentage from a total of columns

Parameters:

| Arguments | Description | | ------------- | ----------------------------------------- | | $c | Column quantity from 0 to $total | | $total | Total of columns |

div {
  width: getWidthByColsAndTotal(2, 6);
}

setFlexWidth($width)

Mixin to set a fixed width element into the flexbox

Parameters:

| Arguments | Description | | ------------- | ----------------------------------------- | | $width | Width of the element |

@include setFlexWidth(80%);

//or

@include setFlexWidth(getWidthByCols(6)); 

//or

@include setFlexWidth(getWidthByColsAndTotal(6, 10)); 

buildGrid($prefix)

Mixin to generate the css necesary to support the grid scaffolded with the attributes of .col elements

Parameters:

| Arguments | Description | | ------------- | ----------------------------------------- | | $prefix | Prefix of each breakpoint |


.col {
  padding-left: $gutter;
  padding-right: $gutter;
  flex-grow: 1;

  @include buildGrid('xs');
  @include mq-sm {
    @include buildGrid('sm');
  }
  @include mq-md {
    @include buildGrid('md');
  }
  @include mq-lg {
    @include buildGrid('lg');
  }
  @include mq-xl {
    @include buildGrid('xl');
  }
}