Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
detective-stylus
Advanced tools
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.
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']
Similar to detective-stylus, postcss-import is used to process CSS files to find and inline import statements. While detective-stylus is specific to Stylus files, postcss-import works with CSS files and is part of the PostCSS ecosystem, offering a broader range of CSS processing capabilities.
rework-import is another CSS preprocessor tool that allows you to manage and inline your CSS imports. It's similar to detective-stylus in its goal of resolving file dependencies but operates within the context of the Rework CSS preprocessor system, making it more suitable for projects that are not specifically using Stylus.
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.
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);
MIT
FAQs
Get the dependencies of a Stylus file
The npm package detective-stylus receives a total of 1,339,151 weekly downloads. As such, detective-stylus popularity was classified as popular.
We found that detective-stylus demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
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.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.