0.3.0 • Published 12 years ago
webant-handler-external v0.3.0
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-externalUsage
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.jsAll 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 test0.3.0
12 years ago