HTML5 Boilerplate 7.3.0 Released

We just released HTML5 Boilerplate 7.3.0.

In addition to the changes below, we also started using Github Actions to publish our npm package. It was pretty easy. I wrote up the process.

HTML5Boilerplate Changelog

  • Updated to Modernizr 3.8 (2b2bb45)
  • Updated to Gulp 4 (#2151)
  • Updated package.json (#2162) and enabled package-lock.json (abe2087),(#2145)
  • Remove redundant rules from .editorconfig (#2157)
  • Small docs maintenance updates (#2155), (#2164), (#2165), (#2167) & (#2168)
  • Bump lowest supported version of node to 8.x (#2142)
  • Remove .jscsrc config and remove gulp-jscs from package.json (#2153)

Thanks again to Christian Oliff for his work on this release. I continue to appreciate his help on tasks and his attention to detail. I’d be a mess without him on the team.

And, as always, thanks to our many contributors. You are the best!

As always, are you interested in helping out? Check out our current issues, submit an idea for a new feature or look at one of the other H5BP projects to see if there’s something else you’re interested in helping with. It’s fun.

Download the latest from github or install it from npm.

Using Github Actions to Publish the HTML5 Boilerplate npm Package

We just released HTML5 Boilerplate 7.3.0. As part of that release we integrated Github Actions in order to publish our npm package when we cut a Github release. Doing so was pretty easy. This is how I ended up doing it.

To start, I enabled Github Actions for the repo. To do so check “Enable local and third party Actions for this repository” on the “settings/actions” tab of the repository.

Next, I created a workflows directory inside our .github folder and added a new file called npmpublish.yml

Here’s what that file looks like. It’s based on one of the default Actions that Github provides, conveniently.


name: publish npm

on:
  release:
    types: [published]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: npm ci
      - run: npm run build

  publish-npm:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: https://registry.npmjs.org/
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.npm_token}}

Let’s go through what it does. The first line gives the action its name.


name: publish npm

This is the name that will show up in the Actions tab within Github.

The next section indicates that this action should run on a release event, specifically when a release is published. Github releases are basically enhanced git tags and we use them to neatly package up our dist folder for easy consumption as a zip folder. The type property actually accepts a list, but since we’re publishing to npm, we only want to do this when the code is actually released.


on:
  release:
    types: [published]

The next section contains the jobs that we will run, build and publish.

First up is build. I just used the default runs-on option- ubuntu-latest, since I’m not doing anything particularly fancy. This just means my work will run on a machine running Ubuntu.

Following that are some default Actions:

  • actions/checkout@v1, which checks out your repository, so that your workflow can access the contents of your repository.
  • actions/setup-node@v1, which installs a specific version of node for your project to use. In our case we’re using node version 12.

Finally, with the environment set up, we run two commands. npm ci, which is a continuous integration version of the more familiar npm install command. npm ci uses package-lock.json and some other optimizations to build out node_modules dependencies more quickly than npm install. Then we run npm run build which is our standard build command. That is an alias for gulp build and it generates the contents our our dist folder.


 build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: npm ci
      - run: npm run build

At this point we’re ready to publish to npm. That happens in our next job, npm-publish. Here we have a new wrinkle, the needs property. This just means that it requires the previous build job to be there before it can run. After that, the setup is similar. It runs on ubuntu-latest, it checks out the code and sets up our node environment. The one change in the environment set-up is that it sets the registry-url to https://registry.npmjs.org/. This is the default, but your organization might have a different private registry. You would set that here.

Finally, we run npm publish which does the actual job of publishing the project out to npm. This is just the standard npm command. This command uses the environment variable NODE_AUTH_TOKEN for authentication. The following section shows how to set up authentication for npm.


 publish-npm:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: https://registry.npmjs.org/
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.npm_token}}

To set up a token to use for authentication with npm, first go to npmjs.com/ and open up the tokens page.

Click on the “create new token” button.

Select “read and publish.”

Copy the newly created token.

Head over to Github. Click on “settings” and then “secrets.” Add a new secret. Call it npm_token and then paste in the npm token.

And that’s that. Authentication for npm is set up.


This is just a basic example of what you can do with Github Actions, but was super convenient for me, so I thought it was worth sharing.

HTML5 Boilerplate 7.2.0 and main.css 2.0.0 released

We just released HTML5 Boilerplate 7.2.0 and main.css 2.0.0. Even with the major release number on main.css, both of these are basically maintenance releases. Open Source isn’t always about the big stuff.

We also did a bunch of clean-up around the related H5BP projects, with updates to HTML5Boilerplate.com and h5bp.org. We integrated main.css as a direct dependency on both projects and did some other clean-up.

HTML5Boilerplate Changelog

Download the latest from github or install it from npm.

main.css Changelog

  • Add .stylelintrc config (#18)
  • Rename visuallyhidden to sr-only (#27)
  • Fix broken link to ‘printing tables’ page (#20)
  • Alphabetize properties (#20)
  • Add stylelint-config-recommended to package.json
  • Add CONTRIBUTORS.md(#9)
  • Minor devdeps and README updates (#11), (#24)

Download the latest from github or npm

Mastering SVG is just $10 from Packt

I actually have a proper post I’m writing for today or Monday, but for now, feast your eyes on this stellar deal on my latest book, Mastering SVG. It’s just $10 at Packt right now.

I’m also working on a new SVG visualization. I’m not sure when it will be ready to share and write about here, but I’ve got a small data set I’m playing with so if you’re interested in SVG, keep your eyes on this space.

Deal Alert! Mastering SVG eBook Available for Just $10 from Packt

If you’re at all interested in my latest book, Mastering SVG, then this is your lucky day (fortnight, actually) as my book is part of their current eBook sale. Between now and April 30th, it’s just $10 along with like a billion other titles.