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

scry-css

v0.4.2

Published

Suggestion engine for CSS variables and mixins

Downloads

18

Readme

Build Status Coverage Status

NPM

Scry-CSS

Easily discover LESS/SASS variables and mixins in large scale projects.

demo.gif

Need

As a developer
I want to find all available LESS/SASS variables & mixins in my project and dependencies without manually going through all of the project files
So that I can increase productivity and code quality

What's this all about?

This tool is useful in large projects that make heavy use of LESS or SASS variables and mixins. Onboarding new members in such projects is often difficult because of lack of documentation, and this can lead to developers rewriting their own LESS/SASS variables due to insufficient knowledge of the project. This is both counterproductive and dangerous because your project may have a style guide that you wish to enforce.

Imagine a scenario where your developers just write the code that they want, and during a code review, you run scry-css to find out if they followed your project's style guide or not (ideally they'd run the tool themselves). This leads to a more interactive learning experience compared to the old way of forcing them to read the documentation or all of your "base" CSS files beforehand.

How to use scry-css

npm install -g scry-css scry-css [options] <directory> <files...>

Command line options:

  • -r: How to report results, options are json or console, the default is console and will output to stdout
  • directory: Absolute path to the directory where less/sass variables/mixins are located
  • files: List of absolute paths to your working files, separated by spaces

Contribute

Pull requests are very appreciated :-)

I'm using Travis CI to build, and Coveralls for code coverage (Istanbul does the actual instrumentation).

PRs will only be accepted if they do not reduce the test coverage under 95%, regardless of how important the code is to the project.

To run the tests:

npm test

If you'd like to keep the tests running while you're working you can run:

npm run test:watch

This will also provide you a system notification whenever you change your code to let you know if the tests still pass.

ESLint is integrated into the project as a pre-commit hook (along with the unit-tests), you can't commit unless all the unit-tests pass and there are no linting errors (unless you manually force the commit, which I don't recommend). As linting rules I'm using airbnb with a few twists, check out .eslintrc.js for the details, and just run npm run lint to see the results at any time.

One last note; this tool requires at least Node 6.0, there are no plans to support older versions.

FAQ

Q: I don't get it. I use Sublime/WebStorm/Atom and I just type @ and I get variables suggested. Why would I use your tool?

A: If you're happy with your IDE in control, then that's fine. I used to rely on my IDE for everything, too. But how does an IDE help you review somebody else's code? Do you checkout his branch locally and verify it? Are you absolutely sure your IDE suggests variables that are inside node_modules? This tool is IDE agnostic and can be run in a CI environment using the json reporter option. It is a much more flexible solution that can be expanded further (see the Github Issues tab for my vision).

Q: How are variables suggested?

A: I use the fuzzy search algorithm supplied by fuzzaldrin

Q: I think the name of a variable is not enough for it to be suggested. Any plans on including the value of the variable too?

A: Yes, there are plans. Watch the Issues in GitHub for more info.

License

This project uses the MIT license.