node-sass-more-utils

1.0.2 • Public • Published

node-sass-more-utils

Build Status Version License

This package provides even more helpers for working with the Sass values that node-sass passes to javascript functions that are exposed as sass functions.

Installation

npm install node-sass-more-utils --save

Usage

var sass = require("node-sass");
var sassUtils = require("node-sass-utils")(sass);
var moreSassUtils = require("node-sass-more-utils")(sass, sassUtils);
 
var $example = moreSassUtils.toSass("Hello");

API

moreSassUtils.toJS(value, [options])

Converts a Sass value to a JS value.

Examples:

var $example = sass.types.String("Hello");
var example = moreSassUtils.toJS($example);
 
var $number = sass.types.Number(15, "px");
var number = moreSassUtils.toJS($number);

moreSassUtils.toSass(value, [options])

Converts a JS value to a Sass value.

Examples:

var example = "Hello";
var $example = moreSassUtils.toSass(example);
 
var simple = [1, 2, 3, 4];
var $simple = moreSassUtils.toSass(simple);
 
var list = [1, 2, 3, 4];
var $commaSeparated = moreSassUtils.toSass(list, {
  separator: true // default
});
var $spaceSeparated = moreSassUtils.toSass(list, {
  separator: false
});
 
var simpleNumber = 10;
var $simpleNumber = moreSassUtils.toSass(simpleNumber);
var $simpleNumberWithUnits = moreSassUtils.toSass(simpleNumber, {
  unit: "px"
});

Readme

Keywords

none

Package Sidebar

Install

npm i node-sass-more-utils

Weekly Downloads

4

Version

1.0.2

License

Apache-2.0

Last publish

Collaborators

  • chriseppstein
  • eoneill
  • krisselden
  • stefanpenner