Blue Flower

just create a sample  velocity-text.js  file.

/** * Created by drvijay on 12-10-2016. */var context = {
        "name": "velocity"}

var initialString = "Hello, ${name}!";

var velocityjs = require("velocityjs");
var renderedString = velocityjs.render(initialString,context);

// go to cmd type node velocity-text.js
First install velocityjs in your node_modules

npm install velocityjs

Now from your project (where the node_modules mentioned above exists) use browserify

browserify -r velocityjs  > velocity.js

This will create a velocity.js file that you can include in your website directly. If you don't have browserify then do npm install -g browserify


In your webpage js file first require velocityjs

var velocityjs = require("velocityjs");

Now to get the templated html do

var renderedString = velocityjs.render(initialString,context)

Note that velocity does not care if your initial string was html or not, you need to ensure that