Skip to content

PeterNaydenov/code-assembly-line

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Assembly Line

Code-Assembly-Line works for node.js and browsers.

It's not a standard template engine

Engine works with templates, data and processes. All items are described in JSON compatible format, in a way to exchange resources via standard AJAX calls. Templates are logicless and are fully decoupled from the data. Partial rendering nature of this engine will give you an opportunity to balance rendering between server and client and you will be able to separate localization, design and data rendering processes. Choose a strategy on missing property values and have fine control on data during rendering process by using hook functions. In brief - Code-Assembly-Line.

Installation

Installation for Node.js based projects:

From the console:

 npm i -S code-assembly-line

It will install module in to the project. You can start using it by

 const CodeAssemblyLine = require ( 'code-assembly-line' );
 const tplEngine = new CodeAssemblyLine();   // Create instance of template engine

Installation for browsers

Just go to '/dist' folder and get copy of 'code-assembly-line.min.js'. Put the file inside your project folder and add a reference to it from HTML code by using this script tag:

 <script src="code-assembly-line.min.js"></script>

Library is avalable as 'CodeAssemblyLine' and start using it.

const tplEngine = new CodeAssemblyLine();

Find working example in file '/dist/index.html'.

Links

Known bugs

(Nothing yet)

Upgrade Notes

1.x.x - 2.x.x

Breaking change in .insertProcessLib method. In version 1.x method expects JSON argument. Version 2.x require object from type extProcessLib where key is processName and value is extProcess type.

Breaking change in .getProcessLib method. In version 1.x method returns JSON. Version 2.x returns object from type extProcessLib.

Code change required:

// v.1.x.x
tplEngine.insertProcessLib ( libData, libName );
// libData:string. JSON representation of extProcessLib
const libJSON = tplEngine.getProcessLib ()

// convert to version 2.x.x
tplEngine.insertProcessLib ( JSON.parse(libData), libName )
const libJSON = JSON.stringify ( tplEngine.getProcessLib ())

No more code changes required.

Release History

2.0.0 (2018-01-09)

  • Fix: method getProcessLib returns JSON representation of intProcess type object. Should be object of extProcessLib type;
  • Method 'getTemplateLib' without arguments will return all templates without modification;
  • Breaking change: Method 'getProcessLib' returns 'extProcessLib'. Was JSON representation of 'extProcessLib';
  • Breaking change: Argument extLib for method 'insertProcessLib' was changed. Was JSON, now is extProcessLib object;

1.0.3 (2017-12-31)

  • Run throws console error if any errors
  • Bug: method getProcessLib returns JSON representation of intProcess type object. Should be JSON representation of extProcessLib type;

1.0.2 (2017-12-23)

  • Process-step 'add' was switched on;
  • Readme has link to documentation wiki;
  • Bug: method getProcessLib returns JSON representation of intProcess type object. Should be JSON representation of extProcessLib type;

1.0.0 (2017-12-17)

  • Process-step 'add' is not active.
  • Node.js module;
  • Browser module;
  • Test package;
  • Bug: method getProcessLib returns JSON representation of intProcess type object. Should be JSON representation of extProcessLib type;

Credits

'code-assembly-line' was created by Peter Naydenov.

License

'code-assembly-line' is released under the MIT License.

About

Javascript template engine. Works server and client side

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published