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

inline-coverage-styles

v0.1.1

Published

Inline CSS for code coverage report

Downloads

10

Readme

Inline coverage styles

Build Status codecov

Description

Inline CSS stylesheets into HTML files.

The goal of this project is to fix an issue on VSTS or Azure devops, where code coverage report assets can't be loaded, as the reports are loaded in a sandboxed iframe.

See :

Nota Bene

This project can be used not only for inlining linked stylesheets in HTML code coverage reports, but also for any folder with HTML files.

Installation

Locally :

  • npm : npm i inline-coverage-styles
  • yarn : yarn add inline-coverage-styles

Or globally :

  • npm : npm i -g inline-coverage-styles
  • yarn : yarn global add inline-coverage-styles

Usage

const ics = require('inline-coverage-styles')

ics({ baseDir: 'coverage' })

Options

baseDir: string (required)

The absolute path to the coverage report directory. A relative path might work but it's not tested.

css: string (optional)

A string with a bunch of css rules to inject in a <style> tag. Injected before the <head> closing tag to avoid any cascade issue.

Examples

Two examples are provided in this repository:

To run these tests :

  • clone this repository
  • yarn install
  • yarn run test && node ./examples/inline_coverage.js
  • or yarn run test && node ./examples/inline_coverage_with_extra_css.js

Roadmap

  • [ ] Add CLI
  • [ ] Increase code coverage
  • [ ] test support for relative path

Inspiration & motivation

These project is directly inspired from vsts-coverage-styles. I've decided to build this project :

  • vsts-coverage-styles is difficult to mock in my custom build processes,
  • vsts-coverage-styles does not have tests,
  • I wanted to have a solution with streams instead of having the whole file loaded in memory, to avoid memory issues. Some coverage folders may have a log of HTML reports files.
  • There is no caching of linked CSS files in memory contrary to vsts-coverage-styles. The linked stylesheets are first minified and then only the minified version will be loaded from filesystem using stream.