spa-assets

0.0.2 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i spa-assets

Weekly Downloads

2

Version

0.0.2

License

BSD

Last publish

Collaborators

  • zevero