Framework agnostic, extensible web component compiler and package manager
Compiles web components declared as HTML to separate Javascript, CSS and HTML files.
Designed primarily for skatejs with support for polymer coming soon.
To install the command line interface run:
npm i -g trucks
To use the compiler library programatically:
npm i trucks-compiler --save-dev
See trucks-compiler for usage and more documentation.
The quickest way to get started is to install the command line interface, compile a package and open build/index.html
in a recent version of chrome.
trucks npm://trucks-example-skate-component -o build
Or from the file system:
trucks examples/skate-component/components.html -o build
In each case the trucks.js compiler configuration file is used.
More documentation is in the manual also available on a single page.
Component projects are in the examples directory.
Plugins are in packages.
The trucks-compiler library provides the core functionality; it bundles plugins for each compiler phase:
- load Read the HTML import tree.
- parse Parse the
<dom-module>
elements. - transform Run tree transformations.
- generate Create output file contents.
- write Write output files to disc.
- core Abstract class for resolver plugins.
- file Default resolver for the
file:
protocol. - http Resolver for the
http:
andhttps:
protocols. - npm Resolver for the
npm:
protocol.
- skate Compiles HTML templates to render functions.
- less Preprocess less sources.
- sass Preprocess sass sources.
- stylus Preprocess stylus sources.
- trim Trim whitespace from inline styles and scripts.
- style-extract Write stylesheets for each component.
- style-inject Read and overwrite stylesheets for each component.
- csp Content security policy transformations.
- bundle Bundle input files with the generated output files.
- copy Copy input files to the output directory.
- tree Humanize the component tree using archy.
- usage Generate component usage examples.
- page Inject output files into HTML templates.
MIT
Created by mkdoc on August 8, 2016