Compiler API
The developer interface for the Ink compiler is designed to be expressive and easily access the Ink library in most scenarios. To create a new ink compiler you can follow the code below.
The ink() function itself takes in the following options, all of which are optional.
API: InkOptions
Property | Returns | Description |
---|---|---|
brand? | string |
The brand prefixed before the component tag name. Example |
cwd? | string |
The project's current working directory (cwd). Example |
fs? | FileSystem |
The file system being used to read/write files. Example |
emitter? | EventEmitter |
The NodeJS EventEmitter instance being used. Example |
minify? | boolean |
Whether to minify the generated JavaScript code. Example |
tsconfig? | string |
The location of the used tsconfig.json. Example |
extname? | string |
The component file extension. Example |
Calling ink() as in compiler = ink({/*options*/}) returns the Ink compiler which contains the following object.
API: InkCompiler
Property | Returns | Description |
---|---|---|
config | Config |
The Ink configuration Example |
fs | FileSystem |
The file system being used. Example |
emitter | EventEmitter |
The NodeJS EventEmitter instance being used. Example |
manifest | DocumentManifest |
The manifest registry used to map build IDs to document entry files. Example |
component( ) | Component | |
fromId( id: string ) | DocumentBuilder |
Returns a new DocumentBuilder instance given a build ID. Example |
fromCache( cacheFile: string ) | Build |
Returns build information from a compiled template. Example |
fromSource( sourceFile: string ) | DocumentBuilder |
Returns a new DocumentBuilder instance given a template source file. Example |
use( options: Function ) | InkCompiler |
Enables a default build cache strategy. Example |
asset( assetFile: string ) | Asset |
Returns a compiled build asset, given an asset file name. Example |
client( sourceFile: string ) | string |
Returns a compiled client script, given the the template source file. Example |
import( sourceFile: string ) | Build |
Returns build information, given the the template source file. Example |
markup( sourceFile: string ) | string |
Returns a compiled markup, given the the template source file. Example |
render( sourceFile: string , props: Hash ) | string |
Returns the final HTML markup, given the the template source file. Example |
server( sourceFile: string ) | string |
Returns compiled server code, given the the template source file. Example |
styles( sourceFile: string ) | string |
Returns compiled css styles, given the the template source file. Example |