webant-handler-external

0.3.0 • Public • Published

node-modules-webant-handler-external

Require externally hosted javascript and CSS files with webant

Installation

There should be no need to install this module since it's required by the webant module by default.

If for some reason you'd like to use the module outside of webant, install as follows:

$ npm install webant-handler-external

Usage

Ensure the external handler is present in your webant configuration file.

An example configuration file which uses this handler may look like this:

{
    "jsEntryPath":"%%base%%/src/js/main.js",
    "jsDestPath":"%%base%%/build/main.js",
    "htmlEntryPath":"%%base%%/src/index.hbs",
    "htmlDestPath":"%%base%%/build/index.html",
    "handlers":{
        "external":{}
    }
}

Note that both htmlEntryPath and htmlDestPath must be defined to make full use of this handler.

You may now require CSS files via the comment style:

//=>require https://awebsite.com/path/to/styles.css
//=>require http://another.website.net/assets/popularlibrary.js

All external files required this way can be accessed in the handlebars file at htmlEntryPath as follows:

<!DOCTYPE html>
<html>
    <head>
        {{#each externalCss}}<link rel="stylesheet" type="text/css" href="{{{this}}}" />{{/each}}
        {{#each externalJs}}<script type="text/javascript" src="{{{this}}}"></script>{{/each}}
    </head>
    <body></body>
</html>

See the webant module for more information.

Tests

$ npm test

Readme

Keywords

none

Package Sidebar

Install

npm i webant-handler-external

Weekly Downloads

0

Version

0.3.0

License

MIT

Last publish

Collaborators

  • theakman2