Trucks
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.
Install
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.
Getting Started
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.
Manual
More documentation is in the manual also available on a single page.
Examples
Component projects are in the examples directory.
Plugin List
Plugins are in packages.
Core
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.
Resolvers
- 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.
Transforms
Compilers
- skate Compiles HTML templates to render functions.
Preprocessors
- less Preprocess less sources.
- sass Preprocess sass sources.
- stylus Preprocess stylus sources.
- trim Trim whitespace from inline styles and scripts.
Styles
- style-extract Write stylesheets for each component.
- style-inject Read and overwrite stylesheets for each component.
Miscellaneous
- 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.
Generators
- page Inject output files into HTML templates.
License
MIT
Created by mkdoc on August 8, 2016