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

csscritic

v2.0.1

Published

A lightweight tool for regression testing of Cascading Style Sheets.

Downloads

16

Readme

CSS Critic

What?

One picture might say more than 1000 words:

For background information watch the screencast or if you feel like playing around have a look at the runnable instance. This example project helps you get started with your own setup.

Why?

Your web stack should be fully testable. CSS Critic closes the gap in front end testing and makes HTML & CSS testable - no more broken UI. For example, make it supervise changes to your project's responsive styleguide so you know things are looking good.

How is it different to the other tools out there?

We believe that your UI will change often enough that a lightweight process on managing changes (near instant feedback, anyone?) is more important than a heavy-weight one which could offer tighter control. Also CSS Critic aims at bridging the gap between user experience (UX) people and (UI) developers. You probably won't find any easier way of sharing your UI tests than as the simple web page that CSS Critic basically is. And don't feel put down by the "CSS" bit, you may throw anything at it that can be converted into a simple image.

How to install?

$ npm install csscritic

See node_modules/csscritic/example/RegressionRunner.html for an example on how to take it from there.

How does it work?

CSS Critic checks your current layout constantly against a reference image you have provided in the past. If your layout breaks (or simply changes - CSS Critic can't tell) your tests fail.

Get started:

  1. Create a RegressionRunner.html similar to the one under example/ and put it with your code that is to be tested.

  2. Register your page under test via:

    csscritic.add({
        url: 'SOME_URL',  // link to the test case HTML document
        desc: 'some text' // optionlly, a description of the test case (see API for even more options)
    });
  3. Serve the directory on a local webserver via python3 -m http.server and open the RegressionRunner.html in your favourite browser

  4. Now save the resulting image as future reference.

  5. Re-run the RegressionRunner.html and see your test passing. Congratulations.

What do I do if my test fails?

  1. Have a look at the diff image and visually inspect what has changed.

  2. If the change is an unwanted one fix your CSS,

  3. If deliberate accept the change (generating a new reference image).

Developing CSS Critic

For tests install Node.js and run

$ npm install && npm test

Build Status

Limitations

  • Currently works in Firefox and Chrome only.
  • Same-origin restrictions apply when sourcing files. All files referenced need to be inside the same directory as the RegressionRunner.html or in ones below.
  • Because of the way the HTML is rendered internally certain limitations apply, see the documentation of the render backend.

For more information see the FAQ and API.

Licensed under MIT. Maintained by @cburgmer. Copyright (c) 2012, 2013 ThoughtWorks, Inc.