trucks-resolver-http
v1.0.8
Published
HTML import resolver for the http: and https: protocols
Downloads
16
Readme
HTTP Resolver
HTML import resolver for the http: and https: schemes.
Resolves HTML imports using the http:
and https:
schemes.
<link rel="import" href="https://example.com/components.html">
Install
npm i trucks-resolver-http --save-dev
For the command line interface see trucks-cli.
Usage
Register the http
protocol plugin:
const options {
files: ['https://example.com/components.html'],
protocols: ['http']
}
API
HttpResolver
Resolve http:
and https:
protocols.
HttpResolver
public HttpResolver()
Create an HTTP resolver.
resolve
public resolve(cb)
Loads a remote HTTP resource from the network and invokes callback with the response body.
If the response has a Content-Encoding
containing gzip it is deflated.
cb
Function callback function.
http
public http(state, conf)
Plugin for the http resolver.
Registers the resolver class for the http:
and https:
protocols unless
the secure
option is given in which case the http:
protocol is not
registered and attempts to use http:
URLs in HTML imports will generate
errors.
state
Object compiler state.conf
Object plugin configuration object.
Options
secure
Boolean=false only usehttps:
.
License
MIT
Created by mkdoc on July 22, 2016