node package manager


A simple asset templating library that turns html template tags into js and css links

A function that replaces {{ js }} and {{ css }} template tags in html with the appropriate script and css link tags

    npm install asset-pipe
    var AssetPipe = require('asset-pipe');
    var pipe = new AssetPipe(); // instantiates a new asset pipe with scripts and styles loaded from the assets.json file 
    var inputHtml = '<head>{{ js }} {{ css }}</head>';
    var parsedHtml = pipe.parse(inputHtml);


            "development" :
                    "scripts" : { "jquery":{
                            "path": "jquery.js"
                    "styles" : { "main": "main.css"}

This would output

    <head><script src="/jquery.js" type="text/javascript"></script><link href="/main.css" rel="stylesheet" /></head>

The AssetPipe constructor optionally takes two parameters , "config", and "basePath". "config" replaces the json file with the given config, and the "basePath" parameter prepends a base path before the script and style sources.