$ npm install detective-sass
Find the dependencies of a sass file
npm install detective-sass
Note: This is specific to the .sass style syntax of the Sass preprocessor. For SCSS support, please see node-detective-scss.
It's the SASS counterpart to detective, detective-amd, and detective-es6.
import fs from 'node:fs';
import detective from 'detective-sass';
const content = fs.readFileSync('styles.sass', 'utf8');
// list of imported file names (ex: '_foo.sass', '_foo', etc)
const dependencies = detective(content);
// or to also detect any url() references to images, fonts, etc.
const allDependencies = detective(content, { url: true });
const { default: detective } = require('detective-sass');
url (optional): (Boolean) also detect any url() references to images, fonts, etc.© 2010 - cnpmjs.org x YWFE | Home | YWFE