Rikkei Module Compiler
=========
ES6 syntax compiler for VanilarJS.
This is a package, not a framework.
Supported:
- ES6 syntax.
- Babel syntax.
- Async / Await.
- Sass.
Installation
npm install --save rikkei-module-compiler
Configuration
The default config file is module.config.json
.
Full config:
{
// root path of compiled files, default is "public"
"path": "public"
// path to
"publicPath": "/",
// array|string file for compiled
"entry": [
"resources/assets/js/app.js",
"resources/assets/sass/app.scss",
],
// output file, direct without path
"output": {
"script": "js/bundle.js",
"style": "css/styles.css"
},
// notifier enable|disable, default is true
"notify": true
}
Usage
1.Create resources/assets/js/user/index.js
import { Module } from 'rikkei-module-compiler'
export default class extends Module {
constructor() {
super() //required for boot() method
}
/**
* boot module (required)
* @return {void}
*/
boot() {}
}
2.Create resources/assets/js/routes.js
import UserIndex from './user/index'
import UserDetail from './user/detail'
export default {
'/user': UserIndex,
'/user/:id': UserDetail
}
3.Create resources/assets/js/app.js
import Boot from 'rikkei-module-compiler'
import Routes from './routes'
Boot(Routes)
4.Run command node_modules/.bin/rkcompile watch
Api
request
: Global variable when module be called.request.params
: Return all params.request.getParam(paramName)
: Return value of paramName.
Options
-f|--config_file
: Running with other config file.-m|--minifier
: Minimize compiled files.