New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mixgen

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mixgen

Mixins generators for SASS & LESS.

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
113
decreased by-25.66%
Maintainers
1
Weekly downloads
 
Created
Source

Mixgen

Mixgen is a library that will help you to simplify your css.

The idea of this library is to generate classes that will be directly used in your HTML, you will not have to create weird class name because you need to add a specific css property.

Getting stated

Optionally: to install with bower, use:

bower install mixgen --save
npm install mixgen --save

Add Mixin Styles

Add the sass module you need, and call the mixin to generate your classes.

Ex: If you want to generate generic padding classes you will add the padding.scss file and call the mixin like that:

@include generate-paddings();

By default some mixin are using default values located in the variables.scss

Generic Mixin Class Generator

All mixin used to generate your css classes are using the generic mixin called css-generator, this mixin allows you to generate any css class you need.

How it's work

Mixin definition :

@mixin css-generator($className, $cssProperty, $values, $breakpoints);
ArgumentsTypeDescription
$classNameStringThe name of your generated class name
$cssPropertyCss propertyThe css property to use (Ex: padding, background-color, ...)
$values(List of map) or (map)The generated values for the css property and optionally class name concatenated with $className
$breakpointsMapThe breakpoints values (Ex: ('xs': 0, 'sm': 544px, 'md': 768px, 'lg': 992px, 'xl': 1200px))

Example 1

@include css-generator($className: 'color', $cssProperty: color, $values: ('red': #ff0000), $breakpoints: (xs: 0, sm: 544px));

will generate

.color-red-xs {
  color: #ff0000 !important; }

@media (min-width: 544px) {
  .color-red-sm {
    color: #ff0000 !important; } }

Example 2

@include css-generator($className: 'border-top', $cssProperty: border-top, $values: (('xs': 1px), solid, ('red': #ff0000)), $breakpoints: null);

will generate

.border-top-xs-red {
  border-top: 1px solid #ff0000 !important; }

Advanced example :

css-generator('box-shadow', box-shadow, (('h10': 10px), ('v10': 10px), ('s5': 5px), ('red': red)), null);

will generate

.box-shadow-h10-v10-s5-red {
  box-shadow: 10px 10px 5px red !important; }

Included mixin

All mixin using the breakpoints to disable it you have to set the $breakpoints value to null

Borders

ArgumentsTypeRequiredDescription
$colorsMaptrueThe color you want to apply to the border (Ex: ('red': #ffffff, 'blue': #ffffff))
$valuesMapoptional (default values used from variables.scss)The differents values to apply to this border (Ex: ('xs': 1px, 'sm': 2px))
$typeCss propertyoptional (default value is solid)The type of the border (Ex: solid, dotted ...)
$breakpointsMapoptional (default values used from variables.scss)The breakpoints values (Ex: ('xs': 0, 'sm': 544px, 'md': 768px, 'lg': 992px, 'xl': 1200px))

Colors (will generate the background-color and text-color class)

ArgumentsTypeRequiredDescription
$colorsList or MaptrueThe color you want to apply to the border (Ex: ('red': red, 'white': white))
$breakpointsMapoptional (default values used from varaibles.scss)The breakpoints values (Ex: ('xs': 0, 'sm': 544px, 'md': 768px, 'lg': 992px, 'xl': 1200px))

Float (will generate the pull-left and pull-right)

ArgumentsTypeRequiredDescription
$breakpointsMapoptional (default values used from varaibles.scss)The breakpoints values (Ex: ('xs': 0, 'sm': 544px, 'md': 768px, 'lg': 992px, 'xl': 1200px))

Line Height

ArgumentsTypeRequiredDescription
$valuesMapoptional (default values used from variables.scss)The differents values to apply to this border (Ex: ('xs': 1, 'sm': 2))
$breakpointsMapoptional (default values used from varaibles.scss)The breakpoints values (Ex: ('xs': 0, 'sm': 544px, 'md': 768px, 'lg': 992px, 'xl': 1200px))

Margins and Paddings

ArgumentsTypeRequiredDescription
$sizesMapoptional (default values used from variables.scss)The differents values to apply to this border (Ex: ('xs': 1px, 'sm': 2px))
$sidesList of css propertyoptional (default value used from variables.scss)The type of the border (Ex: left, right, bottom)
$breakpointsMapoptional (default values used from varaibles.scss)The breakpoints values (Ex: ('xs': 0, 'sm': 544px, 'md': 768px, 'lg': 992px, 'xl': 1200px))

Text align

ArgumentsTypeRequiredDescription
$sidesList of css propertyoptional (default value used from variables.scss)The type of the border (Ex: left, center, right)
$breakpointsMapoptional (default values used from varaibles.scss)The breakpoints values (Ex: ('xs': 0, 'sm': 544px, 'md': 768px, 'lg': 992px, 'xl': 1200px))

Texts

ArgumentsTypeRequiredDescription
$sizesMapoptional (default values used from variables.scss)The differents values to apply to this border (Ex: ('xs': 10px, 'sm': 15px))
$breakpointsMapoptional (default values used from varaibles.scss)The breakpoints values (Ex: ('xs': 0, 'sm': 544px, 'md': 768px, 'lg': 992px, 'xl': 1200px))

FAQs

Package last updated on 21 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc