npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stylelint_d

v3.2.0

Published

Long running Stylelint daemon

Downloads

496

Readme

stylelint_d

stylelint_d is a long running stylelint daemon that makes CSS linting much faster compared to the official stylelint CLI. It works by creating a daemonized "server" that handles linting, reducing the time it take to run stylelint to only the time it takes to actually lint, without the overhead of instantiating a new Node process. Its main use is for time dependent processes, like linting in a code editor.

Thanks to eslint_d by Maximilian Antoni for the idea!

Install

> npm install stylelint_d

To install globally for all projects:

> npm install -g stylelint_d

Note: stylelint_d depends on node-pty, which depends on the ability to build C++ files. If you run into a node-gyp build issue, please check the documentation for node-pty and make sure you have a proper build system in place. If this is a blocker for you, please open an issue here.

Usage

stylelint_d aims to be as compatible with stylelint as possible, and acts as a very thin wrapper on top of stylelint as much as possible. This means that you should be able to pass any argument to the command line and can expect it to work as it does in the official stylelint CLI. For details on the available flags, please see the official Stylelint CLI documentation.

Server commands

In addition to the flags supported by the official CLI, you can also get information about the running daemon by using the following commands:

# Get the status of the daemon (is it running or not?)
> npx stylelint_d status

# Start the daemon if it isn't running
> npx stylelint_d start

# Restart the daemon
> npx stylelint_d restart

# Stop the daemon
> npx stylelint_d stop

You will get an error message (and a nonzero status code) if you try to run one of the commands in an invalid state, e.g. trying to start when stylelint_d is already running.

stylelint module resolution

stylelint_d tries to use the stylelint package that can be resolved in the path of, in order, 1. path of the config file, 2. path of the first given CSS file, 3. path of the glob, 4. the path where you invocated stylelint_d. This means that whichever version of stylelint that you use should be detected and used by the daemon.

However, if for some reason it cannot detect a valid stylelint package in any of the above, stylelint_d will instead use its built-in version of stylelint.

Troubleshooting

Cannot start daemon

If you have issues starting the daemon, make sure that no other process is using port 48126.

Weird lint results

If you experience linting related issues and aren't getting correct results, stop the daemonized version and run the following command:

> node ./node_modules/stylelint_d/dist/src/daemon.js

And try to lint your file again. If you get a stack trace or some unexpectedly logged error, please create an issue.

Issues and Pull Requests

If you find an bug or something isn't quite right, create an issue with the following information: your stylelint_d version, stylelint version, OS, and the layout of the config file and files that you're attempting to lint. If you received a stack trace, include that as well.

I welcome PRs! 🙂

License

MIT