GithubHelp home page GithubHelp logo

arthurclemens / mithril-starter-rollup Goto Github PK

View Code? Open in Web Editor NEW
26.0 3.0 2.0 199 KB

Mithril Starter Project with Rollup, Babel, LiveReload, Jest and ESLint

JavaScript 100.00%
mithril rollup livereload eslint jest babel

mithril-starter-rollup's Introduction

mithril-starter-rollup

Project setup with:

A couple of styles are included using Tachyon, but these can simply be replaced with your own CSS solution.

Setup

Install dependencies

npm install

Build and watch

Script commands defined in package.json:

  • build: creates a minified bundle in dist/js/
  • serve: serves the build directory at localhost:5000
  • dev: starts a local webserver; creates a bundle in dist/js/ that is being updated with each code change; calls LiveReload to refresh the browser after code changes are built

Call npm run dev and open a web page at localhost:3000. The port number is set by environment variable PORT in package.json.

When making changes, the terminal will show lint errors, if any.

Configuration files

scripts contains a couple of Rollup configuration files. The scripts use rollup.base.js as base configuration.

FYI, the base configuration:

  • Exports createConfig({ includeDepencies })
  • Reads package.json to read package dependencies. If includeDepencies is true, it will include those dependencies in the build file
  • Creates global package names; and sets global m for package "mithril".

Bundler configuration

  • rollup.es.js: Builds an ES2015 module with syntax features that node supports
  • rollup.umd.js: Builds a UMD bundle
  • rollup.watch.js: Builds a UMD bundle that is updated with each file change

Optional environment variables:

  • DEPS (Number 0 or 1): include dependencies
  • WATCH_DIR (String): sets the watch directory when running the dev script
  • PORT (Number): sets the http server port when running the dev script

Other configuration file:

  • .babelrc: Babel configuration

License

MIT

mithril-starter-rollup's People

Contributors

arthurclemens avatar cmnstmntmn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

boazblake artydev

mithril-starter-rollup's Issues

package.json scripts do not work on Windows

Scripts defined in package.json do not work on Windows.

Working variant:

...
  "scripts": {
    "build": "yarn run clean && yarn run rollup",
    "rollup": "rollup -c ./scripts/rollup.umd.js --environment DEPS:1 && rollup -c ./scripts/rollup.es.js --environment DEPS:1",
    "clean": "rm -rf dist/js && mkdir dist/js",
    "dev": "rollup -c ./scripts/rollup.watch.js --environment DEPS:1,PORT:8080,WATCH_DIR:./dist/ --watch",
    "test": "jest src/**",
    "test:watch": "jest src/** --watch"
  },
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.