How to use the template function from grunt

Find comprehensive JavaScript grunt.template code examples handpicked from public code repositorys.

7
8
9
10
11
12
13
14
15
16
grunt.npmTasks([
  'enyo'
]);

var _ = grunt.utils._;
var template = grunt.template.process;

// Draw the help screen.
function displayHelp(withFlags) {
  var pkg = require(path.normalize(__dirname + '/../package.json'));
fork icon7
star icon10
watch icon5

43
44
45
46
47
48
49
50
51
52
        '',
        ' LICENSE: <%= license %>',
        '*/',
        ''
    ].join('\n');
    return grunt.template.process(template, {data: pkg});
})();

var less = (function(){
    var obj = {files : {}};
fork icon3
star icon0
watch icon5

58
59
60
61
62
63
64
65
66
67
68
69
70
71




function updateLibraryFiles(version) {


  var versionRegex = /^(\s*\/\*![^\/]+?v)(\d+\.\d+\.\d+)(([^\n]+?)(\d+\/\d+\/\d+))?/
  var today = grunt.template.today('yyyy/mm/dd')
  var files = glob('lib/*.js')


  files.forEach(updateLibraryFile)

fork icon0
star icon1
watch icon0

24
25
26
27
28
29
30
31
32
33
// TODO: move this out to another build step maybe.
function bannerify(src) {
  var version = grunt.config.data.pkg.version;
  var packageName = this.data.packageName || this.data.standalone;
  return (
    grunt.template.process(
      LICENSE_TEMPLATE,
      {data: {package: packageName, version: version}}
    ) +
    src
fork icon0
star icon0
watch icon2

+ 3 other calls in file