How to use the node-sass.types function in node-sass

To help you get started, we’ve selected a few node-sass examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github energy-data / market-opportunities / gulpfile.js View on Github external
var fs = require('fs')
var gulp = require('gulp')
var $ = require('gulp-load-plugins')()
var del = require('del')
var browserSync = require('browser-sync')
var reload = browserSync.reload
var watchify = require('watchify')
var browserify = require('browserify')
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer')
var sourcemaps = require('gulp-sourcemaps')
var gutil = require('gulp-util')
var exit = require('gulp-exit')
var rev = require('gulp-rev')
var revReplace = require('gulp-rev-replace')
var SassString = require('node-sass').types.String
var cp = require('child_process')
var notifier = require('node-notifier')

// /////////////////////////////////////////////////////////////////////////////
// --------------------------- Variables -------------------------------------//
// ---------------------------------------------------------------------------//

// The package.json
var pkg

// Environment
// Set the correct environment, which controls what happens in config.js
if (!process.env.DS_ENV) {
  if (!process.env.TRAVIS_BRANCH || process.env.TRAVIS_BRANCH !== process.env.DEPLOY_BRANCH) {
    process.env.DS_ENV = 'staging'
  } else {
github sass-eyeglass / node-sass-utils / test / test_sass_utils.js View on Github external
it("should stringify space delimited lists", function (done) {
    var l = sass.types.List(3);
    l.setSeparator(false);
    l.setValue(0, sass.types.Number(5, "px"));
    l.setValue(1, sass.types.Boolean(true));
    l.setValue(2, sass.types.String("'asdf'"));
    assert.equal("(5px true 'asdf')", sassUtils.sassString(l));
    done();
  });
  it("should stringify empty maps", function (done) {
github sass-eyeglass / node-sass-utils / test / test_sass_js_map.js View on Github external
it("can remove keys", function (done) {
    var map = new sassUtils.SassJsMap();
    assert.equal(false, map.delete(sass.types.Number(2, "px")));
    map.set(sass.types.Number(2, "px"), sass.types.String("hi"));
    assert.equal(1, map.size);
    assert.equal(true, map.delete(sass.types.Number(2, "px")));
    assert.equal(0, map.size);
    assert.equal(undefined, map.get(sass.types.Number(2, "px")));
    done();
  });
  it("can check for a key", function(done) {
github sass-eyeglass / node-sass-utils / test / test_infection.js View on Github external
it("null.sassString()", function (done) {
    assert.equal("null", sass.types.Null().sassString());
    done();
  });
  it("boolean.sassString()", function (done) {
github linkedin / eyeglass / test / test_utils.js View on Github external
it("unquote handles sass strings", function(done) {
   var s = sass.types.String;
   assert.equal("asdf", unquote(s('"asdf"')).getValue());
   assert.equal("asdf", unquote(s("'asdf'")).getValue());
   assert.equal("\"asdf'", unquote(s("\"asdf'")).getValue());
   assert.equal("'asdf\"", unquote(s("'asdf\"")).getValue());
   assert.equal("asdf", unquote(s("asdf")).getValue());
   done();
 });
github linkedin / eyeglass / test / test_function_loading.js View on Github external
"hello($name: 'Sucker')": function(name) {
            return sass.types.String("Goodbye, " + name.getValue() + "!");
          }
        },
github mamboer / hexo-renderer-scss / lib / renderer.js View on Github external
"hexo-config($ckey)": function(ckey) {
                var val = getProperty(self.config, ckey.getValue()),
                sassVal = new sass.types.String(val);
                if (userConfig.debug) {
                    console.log('hexo-config.' + ckey.getValue(), val);
                }
                return sassVal;
            }
        }
github jgranstrom / sass-extract / src / struct.js View on Github external
function makeValue(sassValue) {
  switch(sassValue.constructor) {
    case sass.types.String:
    case sass.types.Boolean:
      return { value: sassValue.getValue() };

    case sass.types.Number:
      return { value: sassValue.getValue(), unit: sassValue.getUnit() };

    case sass.types.Color:
      const r = Math.round(sassValue.getR());
      const g = Math.round(sassValue.getG());
      const b = Math.round(sassValue.getB());

      return {
        value: {
          r, g, b,
          a: sassValue.getA(),
          hex: `#${toColorHex(r)}${toColorHex(g)}${toColorHex(b)}`
github Skyscanner / backpack / packages / bpk-mixins / sass-functions.js View on Github external
'encodebase64($string)': str => {
    const buffer = Buffer.from(str.getValue());

    return nodeSass.types.String(buffer.toString('base64'));
  },
};
github fetch / node-sass-asset-functions / index.js View on Github external
processor.image_url(filename.getValue(), function(url) {
        if(!only_path.getValue()) url = 'url(\'' + url + '\')';
        done(new sass.types.String(url));
      });
    },