0.0.7 • Published 8 years ago

sass-maphacks v0.0.7

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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: (
    blue: blue,
    green: green
  ),
  text: black
);

.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