Socket
Socket
Sign inDemoInstall

detective-stylus

Package Overview
Dependencies
0
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    detective-stylus

Get the dependencies of a Stylus file


Version published
Weekly downloads
1.2M
decreased by-10.86%
Maintainers
3
Install size
4.43 kB
Created
Weekly downloads
 

Package description

What is detective-stylus?

The detective-stylus npm package is designed for analyzing Stylus files to find and extract import statements. This can be particularly useful in build tools and bundlers to determine dependencies between stylesheets, allowing for more efficient builds and updates. It parses Stylus syntax to identify `@import` and `@require` statements, enabling developers to programmatically understand dependencies and relationships within their Stylus stylesheets.

What are detective-stylus's main functionalities?

Extract import statements from Stylus files

This feature allows you to pass in a string of Stylus code and returns an array of strings representing the paths of files that are imported or required within that Stylus code. It's particularly useful for build tools that need to track file dependencies.

const detective = require('detective-stylus');
const content = '@import "./mixins.styl"';
const dependencies = detective(content);
console.log(dependencies); // ['./mixins.styl']

Other packages similar to detective-stylus

Readme

Source

detective-stylus

CI npm version npm downloads

Find the dependencies of a Stylus file

npm install detective-stylus

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

Note: this detective uses a regex to find the @import or @require statements.

Usage

const fs = require('fs');
const detective = require('detective-stylus');

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

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

License

MIT

Keywords

FAQs

Last updated on 14 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc