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

phew

v0.0.3

Published

Phew is a simple, opinionated, stand-alone asset pipeline that builds and publishes SASS and ES6 JavaScript assets to S3.

Downloads

2

Readme

Phew

Phew is a simple, opinionated, stand-alone asset pipeline that builds CSS (SCSS) and JavaScript (ECMAScript 6) assets into bundles, and publishes them to S3, so they can be referenced from your HTML pages.

I was tired of bundling my JS and CSS assets into my Golang binaries, and realized that a simple thing like using version numbers instead of fingerprints in my asset filenames would allow me to completely remove my assets from my web server repo, while preserving the nice cache invalidation that comes with fingerprinted files.

With Phew, I just need to maintain a single constant in my web server, the asset version number, and I can eliminate all the headaches that come from checking in your frontend code with your backend code. For services like Elastic Beanstalk and Heroku that uses your Git repo as a delivery mechanism, this repo can help you tremendously (no merge conflicts in compiled assets, etc).

The way it works

Phew will build any file located in the root of the javascripts or stylesheets folders from where the command is run. This means that you can create multiple JS and CSS bundles by having files that imports other files from subfolders. CSS files can use the @import statement. JS files can use the import statement.

See the example folder for a simple example.

Getting started

  1. Create a config.json file in your new assets folder, with at least a version property. This determines the version number in the compiled asset filenames.
  2. Create a javascripts and stylesheets folder and add files
  3. Run phew build

Voila!

Commands

phew build

Will build the assets.

  • --minify (optional) Minifies the assets
  • --versionize (optional) Adds version number to the files

phew server

Use the server command for local development. Simply point your HTML asset links to the phew server, and it'll recompile assets whenever they change.

  • --port (optional) Sets the localhost port. Defaults to 3450.
  • --minify (optional) See above
  • --versionize (optional) See above

phew publish

Publishes all files in the build directory to S3. In a normal workflow you will run phew build then phew publish.

  • --s3Id Specifies the S3 ID to use. Can also be set in config.json
  • --s3Secret Specifies the S3 Access key to use. Can also be set in config.json
  • --s3Bucket Specifies the S3 bucket to use. Can also be set in config.json
  • --s3Prefix (optional) Specifies s3 prefix for all files. Defaults to ""
  • --cacheControl (optional) Specifies the Cache-Control header. Defaults to public, max-age=31536000