spa-assets

clever assets packagement

npm install spa-assets
8 downloads in the last month

Single Page Application Assets Packager

Html-templates are searched for and watched in the given paths and automagically inserted at the end of the main html file with a

<script id="path_id" type="text/x-jqote-template">

(Ready for usage with or without jqote2).

Usage

Everything is relative to root

var config = {
  html: {
    watch: true,
    type: "html",
    root: "website/external/jquery-ui-desktop/", //with trailing / or empty ''
    paths: [ //without trailing /
      "demo",
      "images"
    ],
    insert_before: "</body>",
    source: "demo/demo.html",
    output: "demo.html",
    insert_files: function(id_name, file){     
      return '<script id="jqote_' + id_name + '" type="text/x-jqote-template">\n' +
                file + '\n' +
             '</script>';
    }  
  }
};
spa(config);

On a rainy day, I will parse the source file for any js and css and replace it by uglyfied versions. All img shall be saved in a manifest file for offline usage.

Another idea is to write a minimal manifest and serve all other assets with ajax calls, so we have more control over the process.

npm loves you