How to use the node-sass.types.String 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 gebrkn / copytables / gulpfile.js View on Github external
function sassInlineImage(file) {
    var
        filePath = path.resolve(process.cwd(), file.getValue()),
        ext = filePath.split('.').pop(),
        data = fs.readFileSync(filePath),
        buffer = new Buffer(data),
        str = '"data:image/' + ext + ';base64,' + buffer.toString('base64') + '"';
    return sassTypes.String(str);
}
github haithembelhaj / sass-inline-svg / index.js View on Github external
function encode(content, opts) {
  if (opts.encodingFormat === 'uri') {
    return new types.String('url("' + svgToDataUri(content.toString('UTF-8')) + '")');
  }

  if (opts.encodingFormat === 'base64') {
    return new types.String('url("data:image/svg+xml;base64,' + content.toString('base64') + '")');
  }

  throw new Error('encodingFormat ' + opts.encodingFormat + ' is not supported');
}
github janczizikow / janczizikow-portfolio / gulpfile.js View on Github external
fs.readFile(file, function(err, data) {
      if (err) return done(err);
      data = new Buffer(data);
      data = data.toString('base64');
      data = 'url(data:image/' + ext + ';base64,' + data +')';
      data = types.String(data);
      done(data);
    });
  };
github haithembelhaj / sass-inline-svg / index.js View on Github external
function encode(content, opts) {
  if (opts.encodingFormat === 'uri') {
    return new types.String('url("' + svgToDataUri(content.toString('UTF-8')) + '")');
  }

  if (opts.encodingFormat === 'base64') {
    return new types.String('url("data:image/svg+xml;base64,' + content.toString('base64') + '")');
  }

  throw new Error('encodingFormat ' + opts.encodingFormat + ' is not supported');
}
github stevenhauser / i-have-to-return-some-videotapes / webpack.config.js View on Github external
'twemoji-url': function(emoji) {
        const codePoint = twemoji.convert.toCodePoint(emoji.getValue());
        return sassTypes.String(`url(${twemoji.base}svg/${codePoint}.svg)`);
      }
    }