trucks-resolver-http

1.0.8 • Public • Published

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 use https:.

License

MIT


Created by mkdoc on July 22, 2016

Readme

Keywords

none

Package Sidebar

Install

npm i trucks-resolver-http

Weekly Downloads

0

Version

1.0.8

License

MIT

Last publish

Collaborators

  • muji
  • tmpfs