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 🙏

© 2025 – Pkg Stats / Ryan Hefner

generator-elm

v0.0.36

Published

Generate a minimal Elm + Webpack 4 project

Readme

generator-elm Build Status NPM version Dependency Status

Generate a minimal Elm + Webpack 4 project.

$ yo elm my-app
$ cd my-app
$ npm start
./src/Main.elm served at <http://localhost:3000>

Features

  • Hot reloading: On file save, the app is updated without resetting your Elm models.
  • Sass support: Just write some .scss files.
  • CSS vendor autoprefixing: Automatically adds prefixes like -webkit to your styles when necessary.
  • Modern Javascript: Write ES6 and it'll be compiled to ES5.
  • ESLint: Includes a basic .eslintrc and an npm run lint command.
  • Gzip: Production builds generate dist/main-{js,css}.gz files alongside the uncompressed files.

Install

Install Yeoman (generator framework) and generator-elm globally:

$ npm install -g yo generator-elm

Generate

Generate scaffolding in a target folder (created if it does not exist):

$ yo elm <destinationFolder>

Or in the current folder:

$ yo elm .

Skip the NPM + Elm installs after generation:

$ yo elm my-app --skip-install

Run

Development

Start the local hot-reloading development server and visit http://localhost:3000.

$ npm start

Or start the dev server on a custom port:

$ PORT=8080 npm start

Production

Bundle the app into a dist folder ready to be deployed.

$ npm run build

.
└── dist
    ├── index.html
    ├── 60b725f10c9c85c70d97.css
    ├── 5df766af1ced8ff1fe0a.js
    └── img
        └── ...

It's useful to serve the built dist folder locally for debugging or sanity-checking:

$ npm install -g serve
$ serve dist
Serving dist at http://localhost:5000

Anatomy of the Scaffolding

Here's the generated project folder:

.
├── README.md          # for your personal use, notes
├── elm-package.json   # elm's deps
├── package.json       # webpack's deps, implements the `npm` commands
├── webpack.config.js
├── src                # your elm code/components go in here
│   ├── Main.elm       # root elm component, begin hacking here
│   └── index.js       # root javascript file, webpack entrypoint
├── public
│   ├── index.html     # root html file, Main.elm mounts to it
│   ├── favicon.ico    # a default favicon for you to replace
│   ├── css
│   │   └── index.scss # root css file that should @import other css files
│   └── img
│       └── elm.png
└── dist               # the stand-alone folder generated by `npm run build`
    ├── index.html     # throw the contents on a server and open index.html
    ├── main-<hash>.js
    ├── main-<hash>.css
    └── img
        └── ...

Using Travis CI

TODO: This section has not been updated / checked since the migration to Webpack 4.

We took the liberty to include a .travis.yml file. But you will need to change your webpack config to run it in a performant way. First let's install a new package:

npm install --save-dev global-prefix

Then import it in your webpack.config.js:

const prefix = require('global-prefix')

You want to remove the following from the common part of your config:

      {
        test: /\.elm$/,
        exclude: [/elm-stuff/, /node_modules/],
        use: ['elm-webpack-loader'],
      },

And copy it to both the development and your production config, right after the plugins element. Then change your production config to the following code block, if production is the config travis should use.

    module: {
      rules: [
        {
          test: /\.elm$/,
          exclude: [/elm-stuff/, /node_modules/],
          use: ['elm-hot-loader', 'elm-webpack-loader?verbose=true&warn=true&pathToMake=' + prefix + '/bin/elm-make'],
        },
      ],
    }

That's it, make sure to customize your .travis.yml to your needs.

Changelog

  • 2018 Aug 26 (v0.0.33):
    • Migrated from Webpack 3 to Webpack 4.

License

MIT © Dan Neumann