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

metalsmith-webpack-suite

v1.2.0

Published

> A boilerplate implementation to effectively merge webpack and metalsmith in > development and production environments.

Downloads

9

Readme

metalsmith-webpack-suite

A boilerplate implementation to effectively merge webpack and metalsmith in development and production environments.

MIT License js-standard-style Build Status bitHound Code semantic-release Commitizen friendly

:cloud: Installation

Cloning the repo or downloading a release might be the best idea.

You may build on top of this project or extract parts you need for your own projects.

Afterwars, simply install all dependencies by running:

yarn || npm install

:rocket: Technology

This boilerplate tries to combine the best out of metalsmith and webpack.

Content generation via metalsmithpreviewp

Scripts and stylesheets via webpack

  • Full power of webpack including tree shaking and minimize
  • Uses webpack-dev-server (actually webpack-dev-middleware) under the hood for dev
  • Styles get included via require within page.js and extracted to a css file via ExtractTextPlugin

:bookmark_tabs: Project File Structure

|Pattern|Description| |-|-| |./content/* | website content files, mainly markdown files| |./layouts/*.html | metalsmith-layouts layout files| |./src/config/paths.js | path configuration |./src/assets/css,js | page javascript and stylesheet files| |./src/scripts/*.js | build process & dev environment scripts| |./dist/assets/**/* | webpack output directory| |./dist/site/**/* | metalsmith output directory|

:hammer_and_wrench: Development and tooling

You can start a fully featured development server via yarn dev (or npm run dev).

It will spawn a html server at http://localhost:3000 including browser-sync for live reload.

:recycle: Live reload details

Browser sync spawns a basic webserver with the webpack-dev-middleware injected.

The live reload gets very effective by combining 3 different reload techniques:

  • browser-sync: Rebuilds metalsmith when content or layouts change.
  • webpack-dev-middleware: Triggers browser-sync when webpack files like scripts or styles change
  • nodemon: Restarts dev server when build scripts or config changes

:bulb: Tipps & tricks

  1. The dev server supports the rs shortcut while running. Simply type and hit enter to restart the server manually
  2. The metalsmith-helpers.js in the scripts folder exports two metalsmith debugging plugins: A StatisticsPlugin for a general overview and a DebugPlugin for in-deepth insights
  3. The metalsmith-layouts config contains a little helper for handlebars to output variable content. Usage: <pre>{{debug YOUR_VARIABLE}}</pre> (Hint: use this as variable to debug display the whole file metadata)
  4. Check npm run for an overview of all available scripts.

:gear: Build process

You can run a fresh page build via yarn build (Or npm run build)

  1. npm-scripts: Set DEBUG environment variable to metalsmith* to enable metalsmith debugging
  2. npm-scripts: Clean up ./dist/* directories
  3. webpack: Build javascript and stylesheet files via webpack
  4. metalsmith: Copy webpack assets to site directory
  5. metalsmith: Fingerprint webpack assets
  6. metalsmith: Compile markdown files
  7. metalsmith: Apply layouts
  8. metalsmith: Show statistics

Et voilà. You can find your generated website in ./dist/site/. See below how you can preview and deploy the result.

:ship: Deployment & production server

With yarn deploy (or npm run deploy) you can deploy your latest website directly to GitHub pages via gh-pages

Running yarn server (or npm run server) will spawn a simple production server which is great for testing the final version.

:sparkling_heart: Contributing

This project follows the standard coding and the conventional changelog commit message style. Also it is configured to never decrease the code coverage of its tests.

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. But before doing anything, please read the CONTRIBUTING.md guidelines.