Skip to content

RobertoPrevato/Knight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Knight

Html templates packer. Tool to pack .html files into .js for Angular, Knockout, or inside a custom global variable (abstracted from any library).

Live demo

Features:

  • Console application with documented interface (includes --help)
  • Cross platform: being in Python, it can run on Linux, Windows and Mac
  • Allows to run UnderscoreJs template compilation over templates (useful, for example, to implement localization)
  • Examples in both Angular and Knockout, of view composition with cached templates
  • Provides a way to manage in-memory templates in Knockout (instead of using script tags with type="text/html")

Repository structure:

  • The source folder contains the Python source code.
  • This code can be executed by both Python 2.x and Python 3.x.
  • The source folder also contains a setup.py file used with cx_Freeze to generate the executables.
  • The docs folder contains information used for this documentation, and files for examples in Angular and Knockout.

Examples:

  • Simply download the code and open the index.html in a browser (examples don't require a local web server)
  • Some of the external libraries are loaded using CDN

Commands

  • -h --help displays the help for the console application Help
  • -p / --path path -m / --mode mode {ko,ng} starting from the given folder path, looks recursively inside each direct child folder for .html files, and generates for each directory a templates.js file containing the packed HTML files. Templates Generation

Optional parameters

  • -a --appname application name when generating templates.js files for Angular, the name of a global variable referencing the application object (default == "app").
  • -u --underscoreJsCompile js global variable name allows to run UnderscoreJs compilation on templates, using the given global variable/function. The parameter determines the context passed as argument for _.template function (default == null).

About

Angular and Knockout templates packer. Packs .html files into .js for Angular or Knockout.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published