simple code template or snippets manager written in node.js
npm install code-templates#
This software is in development !!
#
Templates
=========
A simple templates or code snippets manager written in Node.js, for developers.
[ see demo ] (http://templates-harish2704.rhcloud.com/)
Features
--------
* Powerful and flexible template engine (ECT.js) for rendering code template to code. supports coffeescript syntax.
* Powerful text editor (ACE Editor). Supports several language syntax, language snippets, themes many more.
* In-build template helpers ('pluralise', 'singularize', 'capitalize', 'small' )
Usage
-----
``sh`
git clone https://github.com/harish2704/templates.git;
cd templates;
npm Install;
node server.js &;
xdg-open http://localhost:3000;
#### Create a new snippet template.
* Sample data
name :: "Express.js controller Index function"
settings :: { "model": "string" }
Source ::
<% modelClass = @capitalize @model; modelObject = @small @model; modelObjects = @small (@pluralize @model ) %>
function(req, res ) {
<%- modelClass %>.count( {}, function( err, count ){
var paginationParams = {};
paginationParams.count = count;
paginationParams.page = req.query.page;
var pagination = paginator.paginate( paginationParams );
return <%- modelClass %>.find( { }).slice([pagination.start-1, paginator.defaults.size]).exec(function( err, <%- modelObject %> ){
return res.respond('<%- modelObjects %>/index', { <%- modelObjects %>: <%- modelObjects %>, pagination: pagination });
});
});
}
#### Generate code from this template.
* Enter value for each settings keys.
* View code in the editor by pressing submit button
#### Syntax
* settings
Strict json
```
{
'parameter-name' : 'type'
}
available types
'string' => textbox
'number' => textbox
'boolean' => checkbox
* Template
Refer ECT.js template engine.
built-in filters
'capitalize', 'small', 'singularize', 'pluralize'