How to use the query-ast function in query-ast

To help you get started, we’ve selected a few query-ast 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 jgranstrom / sass-extract / src / parse.js View on Github external
export function parseDeclarations(data) {
  const ast = parse(data);
  const $ast = createQueryWrapper(ast);

  const implicitGlobalDeclarations = $ast('declaration').hasParent('stylesheet');
  const explicitGlobalDeclarations = $ast('declaration').hasParent('block')
  .filter(node => isExplicitGlobalDeclaration($ast, node));

  let implicitGlobals = => parseDeclaration($ast, declaration, SCOPE_IMPICIT));
  let explicitGlobals = => parseDeclaration($ast, declaration, SCOPE_EXPLICIT));  

  return { explicitGlobals, implicitGlobals };


A library to traverse/modify an AST

Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis

Popular query-ast functions

Similar packages