npm.io
6.0.1 • Published 2 months ago

@dependents/detective-less

Licence
MIT
Version
6.0.1
Deps
2
Size
6 kB
Vulns
0
Weekly
0
Stars
2

@dependents/detective-less

CI npm version npm downloads

Find the dependencies of a less file

npm install @dependents/detective-less

Note: This is specific to the .less style syntax.

It's the LESS counterpart to detective, detective-amd, and detective-es6.

Usage

ESM

import fs from 'node:fs';
import detective from '@dependents/detective-less';

const content = fs.readFileSync('styles.less', 'utf8');

// list of imported file names (ex: 'foo.less', 'foo', etc)
const dependencies = detective(content);

// or to also detect any url() references to images, fonts, etc.
const allDependencies = detective(content, { url: true });
CommonJS
const { default: detective } = require('@dependents/detective-less');
Options
  • url (optional): (Boolean) also detect any url() references to images, fonts, etc.

License

MIT

Keywords