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

css-bake

v0.1.4

Published

This projects uses [css-polyfills.js](http://philschatz.com/css-polyfills.js/) to generate an HTML and a CSS file from a HTML file and CSS file that contains CSS Rules not supported by browsers or reading systems.

Downloads

9

Readme

This projects uses css-polyfills.js to generate an HTML and a CSS file from a HTML file and CSS file that contains CSS Rules not supported by browsers or reading systems.

Install and Run

You can install locally or globally (npm install -g css-bake). Installing globally will give you access to css-bake from the commandline.

Usage

Required args:

  • --input-html : existing HTML file to convert
  • --input-css : existing CSS file to convert
  • --output-html : new converted HTML file
  • --output-css : new converted CSS file (optional)

Example

given the following HTML:

<html>
  <body>
    <div class="wrapped">Hello World</div>
  </body>
</html>

and CSS files:

.wrapped          { border: 10px solid black; }
.wrapped::outside { border: 10px solid green; }

Run the following:

css-bake --input-html ./test/test.html --input-css ./test/test.css --output-html ./output.html

and you should get the following output.html:

<html xmlns="http://www.w3.org/1999/xhtml">
  <body>
    <span style="border:10px solid green;">
      <div class="wrapped" style="border:10px solid black;">Hello World</div>
    </span>
  </body>
</html>

You may also add an optional --output-css ./output.css which will place the styles in a CSS file instead of "baking" them into the style="..." attribute.

Then, output.html will be:

<html xmlns="http://www.w3.org/1999/xhtml">
  <body>
    <span class="js-polyfill-autoclass-0-dot-wrapped-outside">
      <div class="wrapped">Hello World</div>
    </span>
  </body>
</html>

and output.css will be:

.wrapped {
  border: 10px solid black;
}
.js-polyfill-autoclass-0-dot-wrapped-outside {
  border: 10px solid green;
}

Bonus! Generate a Diff

To do this, you will need to:

  1. generate the old HTML file
  2. make some CSS/HTML changes
  3. regenerate the new HTML file
  4. generate the diff'd HTML file
  5. Open the diff'd HTML in a browser to see the changes

Let's use the example test file in ./test/test.html:

# Generate the **old** HTML file (the file extension is important)
css-bake -i ./test/test.html -c ./test/test.css -o ./old.xhtml

# Change `./test/test.css` by commenting out a line or two and save
# ...

# Generate the **new** HTML file
css-bake -i ./test/test.html -c ./test/test.css -o ./new.xhtml

# Generate the diff'd HTML file
# (the file extension on diff.xhtml is important if opened in a browser)
xsltproc --stringparam oldPath ./old.xhtml ./compare.xsl ./new.xhtml > ./diff.xhtml

# **Note:** The location of old.xhtml in the previous line is
# relative to compare.xsl and **not** the current working directory.