sass-maphacks

0.0.7 • Public • Published

sass-maphacks Build Status npm version Coverage devDependency Status

An Underscore/Lodash-like utility library for Sass maps

Install

npm install sass-maphacks --save-dev

Basic Usage

SCSS

This library needs to be imported into your sass pipeline. Below is an example using Gulp:

var gulp = require('gulp');
var sass = require('gulp-sass');
var maphacks = require('sass-maphacks');
 
gulp.task('sass', function () {
  return gulp.src('./sass/**/*.scss')
    .pipe(sass({
      includePaths: maphacks
    }))
    .pipe(gulp.dest('./css'));
});

Once that is setup, simply @import sass-maphacks as needed in your .scss file:

@import "sass-maphacks/_index";

Importing individual functions

If you wish to manually import and use indivdual functions in your code base (instead of importing all the sass-maphacks things), you can do the following:

// Input (awesome-class.scss) 
@import "sass-maphacks/get";
 
$color: (
  primary: (
    blueblue,
    greengreen
  ),
  textblack
);
 
.my-awesome-class {
  color: _get($color, primary, blue);
}
 
// Output (awesome-class.css) 
.my-awesome-class {
  color: blue;
}

Functions

  • _concat
  • _extend
  • _first
  • _get
  • _indexOf
  • _isMap
  • _last
  • _set

More functions + docs coming soon ❤️

License

MIT © Jon Q

Package Sidebar

Install

npm i sass-maphacks

Weekly Downloads

3

Version

0.0.7

License

MIT

Last publish

Collaborators

  • itsjonq