trucks-resolver-file
v1.0.13
Published
HTML import resolver for the file: protocol
Downloads
34
Readme
File Resolver
HTML import resolver for the file: scheme
Resolves HTML imports using the file:
scheme.
<link rel="import" href="file://components.html">
Default resolver for the load plugin.
Install
npm i trucks-resolver-file --save-dev
For the command line interface see trucks-cli.
Usage
This plugin is bundled with the core library so there is no need to add it however the configuration is:
const options {
files: ['file://components.html'],
protocols: ['file']
}
For command line usage see trucks-cli.
API
FileResolver
Resolve file:
protocols.
FileResolver
public FileResolver()
Create a file resolver.
resolve
public resolve(cb)
Resolves file contents on the local file system using the canonical
path assigned to the file
property.
cb
Function callback function.
getCanonicalPath
public getCanonicalPath()
Compute the canonical path for the file.
When the file path is not absolute if this resolver has a parent file
then the file is resolved relative to the dirname()
of the parent file.
If no parent resolver exists and the path is not absolute it is resolved relative to the current working directory.
If the href
begins with an explicit file://
scheme it is stripped.
Returns an absolute file system path.
file
public file(state, conf)
Plugin for the file resolver.
Registers the resolver class for the file:
protocol.
state
Object compiler state.conf
Object plugin configuration object.
License
MIT
Created by mkdoc on July 22, 2016