1.1.0 • Published 6 years ago

sass-mixins-variables v1.1.0

Weekly downloads
26
License
MIT
Repository
github
Last release
6 years ago

Sass (SCSS) Mixins & Variables

This package offers various mixins and variables I use all the time in my personal projects.

Installation

NPM

  1. Install using NPM:

    npm install --save sass-mixins-variables

  2. Import into your main SCSS file:

    // Import Variables (beta)
    @import 'node_modules/sass-mixins-variables/variables';
    // Import Mixins
    @import 'node_modules/sass-mixins-variables/mixins';

Overwrite default variables

All the variables mixins use are set with !default so can easily be overwritten.

$primary                 : #00deff
$secondary               : #0050ff

$path--image             : 'assets/images'
$path--font              : 'assets/fonts'

$font__size--root        : 16px

$breakpoint__extra-large : 1400px
$breakpoint__large       : 991px
$breakpoint__medium      : 767px
$breakpoint__small       : 480px
$breakpoint__extra-small : 320px

$container__width        : 1040px

Mixins & Functions

These are the available mixins you can use in your SCSS project.

NameTypeDescription
spacingmixinCreates spacing classes for paddings and margins
bg-img-fullmixinExpands full background image CSS with background-size.
bg-img-onlymixinExpands only background-image CSS
all-colorsmixinChanges the color of all the child themes, including main element and: a, h1-h6
all-headings-colorsmixinChanges color of all the headings from h1-h6
calc-remfuncitonConvert pixel into 'rem'. Root size is based on $font__size--root value. Multiple values are accepted, e.g., 10px 20px 10px 20px
calc-emfuncitonConvert pixel into 'em'. Root size is based on $font__size--root value. Multiple values are accepted, e.g., 10px 20px 10px 20px
prop-remmixinAutomatically generates CSS properties with 'rem' unit with a fallback 'px' unit for old browsers. e.g., @include prop-rem( line-height, 50px );
prop-emmixinAutomatically generates CSS properties with 'em' unit with a fallback 'px' unit for old browsers. e.g., @include prop-em( line-height, 50px );
font-sizemixinGenerates font-size from pixel into 'rem' with 'px' as fallback.
marginmixinGenerates margin from pixel into 'rem' with 'px' as fallback. e.g., @include margin( 10px 20px );
paddingmixinGenerates padding from pixel into 'rem' with 'px' as fallback. e.g., @include padding( 10px 20px );
size-remmixinDescription yet to be provided.
widthmixinGenerates width from pixel into 'rem' with 'px' as fallback.
heightmixinGenerates height from pixel into 'rem' with 'px' as fallback.
mediamixinOpens responsive media.
bp-x-largemixinOpens max-width responsive @media with size based on $breakpoint__extra-large variable
bp-largemixinOpens max-width responsive @media with size based defined in $breakpoint__large variable
bp-mediummixinOpens max-width responsive @media with size based defined in $breakpoint__medium variable
bp-smallmixinOpens max-width responsive @media with size based defined in $breakpoint__small variable
bp-x-smallmixinOpens max-width responsive @media with size based on $breakpoint__extra-small
bp-x-large-minmixinOpens min-width responsive @media with size based defined in $breakpoint__extra-large-min variable
bp-large-minmixinOpens min-width responsive @media with size based defined in $breakpoint__large-min variable
bp-medium-minmixinOpens min-width responsive @media with size based defined in $breakpoint__medium-min variable
bp-small-minmixinOpens min-width responsive @media with size based defined in $breakpoint__small-min variable
bp-x-small-minmixinOpens min-width responsive @media with size based defined in $breakpoint__extra-small-min variable
opacitymixinGenerates opacity CSS with fallback for older browsers.
vertical-centermixinMakes child elements vertically centerd. Applied on the parent element. e.g., @include vertical-center( 100px, '.child-item' );
positionmixinShorthand for position CSS properties.
backgroundmixinShorthand for individual background properties. It's used to avoid using background property that overrides all previous background properties.
background-opacitymixinBackground opacity using SCSS rgba function with fallback background color for older browsers. e.g., @include background-opacity(#000, 0.5);
per-calcfunctionConverts pixel into percentage based on container's size. e.g., width: per-calc(250px, 1000px); ---> width: 25%
center-with-widthmixinCenter align block-level element using margin-x auto method. e.g., @include center-with-width( 250px );
gridmixinGenerates custom grid classes with row and columns. e.g., @include grid( $number: 12, $gutter: 30px );
font-per-basefunctionConverts pixel to '%' for font size based on $fontsize--root size. e.g., `font-size: font-per-base( $size: 20px, $base: $fontsize--root );`
strip-unitfunctionStrips a unit from number. e.g., 12px will become 12
flex-containermixinDescription yet to be provided.
primary-gradientmixinDescription yet to be provided.
aspect-ratiomixinConvert pixel into aspect ratio in percentage. e.g., aspect-ratio( 16px 9px ); will convert into 56.25%
single-buttonmixinDescription yet to be provided.
1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago