How to use the sass-graph.parseFile function in sass-graph

To help you get started, we’ve selected a few sass-graph 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 DefinitelyTyped / DefinitelyTyped / sass-graph / sass-graph-tests.ts View on Github external
import { parseFile, parseDir, Graph } from "sass-graph";

// Example copied from readme:
// https://github.com/xzyfer/sass-graph/blob/master/readme.md
const graph1: Graph = parseFile("test/fixtures/main.scss");
const graph2: Graph = parseDir("test/fixtures");
github elastic / elastic-charts / scripts / concat_sass.js View on Github external
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require('fs');
const sassGraph = require('sass-graph');

const graph = sassGraph.parseFile('./src/components/_index.scss');

const root = Object.keys(graph.index)[0];

const content = recursiveReadSCSS(root, graph.index[root]);

fs.writeFileSync('./dist/theme.scss', content);

function recursiveReadSCSS(branchId, branch) {
  if (branch.imports.length === 0) {
    return fs.readFileSync(branchId, 'utf8');
  }
  const file = fs.readFileSync(branchId, 'utf8');
  const sassFileContent = [];
  branch.imports.forEach((branchId) => {
    const content = recursiveReadSCSS(branchId, graph.index[branchId]);
    sassFileContent.push(content);
github fossasia / susper.com / node_modules / node-sass / lib / watcher.js View on Github external
watcher.reset = function(opts) {
  config = clonedeep(opts || config || {});
  var options = {
    loadPaths: config.includePath,
    extensions: ['scss', 'sass', 'css'],
    follow: config.follow,
  };

  if (config.directory) {
    graph = grapher.parseDir(config.directory, options);
  } else {
    graph = grapher.parseFile(config.src, options);
  }

  return Object.keys(graph.index);
};
github kottenator / node-sass-watcher / lib / watcher.js View on Github external
Watcher.prototype.getIncludedFiles = function() {
  var newWatchedFilesGraph = grapher.parseFile(this.inputPath, {
    loadPaths: this.includePaths,
    extensions: this.includeExtensions
  });

  return Object.keys(newWatchedFilesGraph.index);
};

sass-graph

Parse sass files and extract a graph of imports

MIT
Latest version published 2 years ago

Package Health Score

68 / 100
Full package analysis

Popular sass-graph functions