node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey ยป

kantan

Kantan

A relatively small Webpack based development server and build tool with hot-reload and available tree-shaking via Rollup.

This is designed as a quick and easy way to quickly spin up a server and enables you to simultaneously compile ES6 modules without a lot of the extra setup that would normally be a part of this workflow.It even supports CSS hot reloading as well.

This can also serve as a final build packaging tool using Rollup primarily but can also build with Webpack directly if you absolutely need to still use CommonJS modules. Rollup works with CommonJS too but tends to be less reliable during packaging.

Requirements

  • at least node 6.9.1

Installation

Two ways Method one

  • clone into node_modules
  • node node_modules/kantan/bin/cli.js

Method two

  • npm install -g kantan
  • run like any other command line script

Note that if you use method 2 and a custom webpack config - you may have to install additional packages for your project.

Use

Kantan is primarily intended for use as a development server, but can also be used to build packages(note - building bundles is still under re-write).

Each form has some available options. You reference all options on the command line or you can specify a json or js file to write your config in and pass in a path to that file with the flag --configFile

CLI Flags

  • --build add this flag if you want to build files instead of running the dev server
  • --port specifies the port to run the server on
  • --entry specifies the path to the main entry file for your app/site
  • --public specifies the directory that contains your html
  • --customWebpack Specifies the path to your own webpack.config.js file. Will use a default file if one is not specified.
  • --buildConfig Specifies the path to a custom build configuration.

Building

Previously, there was the option to build a bundle in a common js compatible format. Now that ES6 is starting to be directly integrated into browsers, it's assumed that ES6 is what you're going to be building with.

There are some sensible defaults set up now but if need be you can pass in a custom json file specifying build options. See --buildConfig flag above.

CSS Parsing

This dev setup is primarily meant to JS based projects, but CSS parsing is included as well. This is utilizing PostCSS as a pre-processing step as it has a large variety of plugins to change your css however you'd like. By default, it'll compile scss syntax using PreCss. From previous testing, there isn't a difference that I can find yet, but keep in mind that this isn't using the normal Sass rubygem.

Note that this no longer uses chokidar and is all tied into Webpack.