How to use the scss-tokenizer.tokenize function in scss-tokenizer

To help you get started, we’ve selected a few scss-tokenizer 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 xzyfer / sass-graph / parse-imports.js View on Github external
function parseImports(content, isIndentedSyntax) {
  var tokens = tokenizer.tokenize(content);
  var results = [];
  var tmp = '';
  var inImport = false;
  var inParen = false;
  var prevToken = tokens[0];

  var i, token;
  for (i = 1; i < tokens.length; i++) {
    token = tokens[i];

    if (inImport && !inParen && token[0] === 'string') {
      results.push(token[1]);
    }
    else if (token[1] === 'import' && prevToken[1] === '@') {
      if (inImport && !isIndentedSyntax) {
        throw new Error('Encountered invalid @import syntax.');

scss-tokenizer

A tokenzier for Sass' SCSS syntax

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis

Popular scss-tokenizer functions