Skip to content

Introduction

Roberto Asiel Guevara Castañeda edited this page Nov 27, 2019 · 12 revisions

Introduction

Installation

The recommended installation method is through npm who pairs nicely with Webpack and Rollup

~$ npm i trebor

Usage with bundlers

TreborJS have a loader for webpack that it is integrated with the module, all you need to do is just import the loader from the local installation like this:

// webpack.config.js
{
  // other configurations...
  resolveLoader: {
    alias: {
      'trebor-loader': resolve(__dirname, 'node_modules/trebor/loader.js')
    }
  },
}

Also it have a plugin for rollup that it is integrated with the module too, all you need to do is just import the plugin from the local installation like this:

// commonjs
const trebor = require('trebor/plugin');
// or
// es2015 and beyond
import trebor from 'trebor/plugin';

Or it can be used as a CLI to compile stand-alone components

~$ npm i trebor -g

Options

Loader and Plugin

  • comments: <boolean> Whether or not put comments in generated code.
  • directives: <object[]> Array of custome directives to use.
  • format: <string> A string with 'esm' or 'cjs'. default to 'esm'.
  • include: <string> Pattern for files to include. Rollup plugin only.
  • exclude: <string> Pattern for files to exclude. Rollup plugin only.

CLI

Type -help in the console to look the cli options

~$ trebor -help

Now you can go to the next section for learn how to work with this compiler and do awesome things.

Clone this wiki locally