How to use sass-graph - 10 common examples

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 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 mediocre / electricity / lib / index.js View on Github external
function reloadFile(filePath, stat) {
        stat = typeof stat === 'object' ? stat : fs.statSync(filePath);

        var ext = path.extname(filePath);

        if (ext === '.scss') {
            sassGraph.parseDir(directory).index[filePath].importedBy.forEach(reloadFile);
        } else if (ext === '.js') {
            // Clear snockets cache
            snockets.cache = {};
            snockets.concatCache = {};

            snockets.scan(filePath);
            snockets.depGraph.parentsOf(filePath).forEach(reloadFile);
        }

        var relativeUrl = cacheFile(filePath, stat);

        if (stylesheets.includes(relativeUrl)) {
            files[relativeUrl].content = hashifyCss(relativeUrl);
            files[relativeUrl].hash = crypto.createHash('md5').update(files[relativeUrl].content).digest('hex');
        }
    }
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 dynatrace-oss / barista / tools / gulp / tasks / build.ts View on Github external
task('library:styles', () => {
  const stylesGraph = parseDir(join(buildConfig.libDir, 'style'));

  return src(Object.keys(stylesGraph.index), { base: buildConfig.libDir }).pipe(
    dest(buildConfig.libOutputDir),
  );
});
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 dimanech / atlas-guide / gulpfile.js View on Github external
const createImportsGraph = function () {
    importsGraph = require('sass-graph').parseDir(
        pathConfig.ui.core.sass.src,
        { loadPaths: [pathConfig.ui.lib.resources] }
    );
};
github alarner / perk / build / sass.js View on Github external
function rebuildGraph(file, cb) {
		graph = grapher.parseDir(path.join(config.root, sassDir), {
			extensions: ['scss', 'sass']
		});

		if(file) {
			sassyChange(file, cb);
		}
	}
github dimanech / atlas-guide / models / projectimportsgraph.js View on Github external
function getImportsGraph(atlasBaseConfig) {
    const sassSrcPath = atlasBaseConfig.scssSrc;
    const sassSrcExternalImportsPath = atlasBaseConfig.scssAdditionalImportsArray;

    return sassGraph.parseDir(sassSrcPath, {loadPaths: sassSrcExternalImportsPath});
}
github dynatrace-oss / barista / tools / builders / packager / copy-assets.ts View on Github external
(aggr, dir) => {
        return aggr.concat(Object.keys(parseDir(dir).index));
      },
      [] as string[],

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