node-sass-more-utils
More Sass utilities for node-sass.
Last updated 3 years ago by krisselden .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install node-sass-more-utils 
SYNC missed versions from official npm registry.

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"
});

Current Tags

  • 1.0.2                                ...           latest (3 years ago)

4 Versions

  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.0.1                                ...           6 years ago
Downloads
Today 0
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 1
Dependencies (0)
None
Dev Dependencies (13)

Copyright 2014 - 2017 © taobao.org |