Usage Example for handlebars, but this should work for any template engine that takes helpers or filters. var handlebars = require('handlebars'); handlebars.registerHelper('gradient', require('{%= name %}')); Then use in your templates like this: <style> .page-header { {{gradient "Man of steel"}} } </style>