javascript - grunt-contrib-concat: how to use option "process" -


i writing build system using grunt javascript library (widget) concatenate, minify , package files distribution.

in concatenation step wanted insert current date 1 of js files process option of grunt-contrib-concat, stated:

type: boolean object default: false

process source files templates before concatenating.

  • false - no processing occur.
  • true - process source files using grunt.template.process defaults.
  • options object - process source files using grunt.template.process, using specified options.
  • function(src, filepath) - process source files using given function, called once each file. returned value used source code.

(default processing options explained in grunt.template.process documentation)

concat part gruntfile.js:

    concat: {         options: {             stripbanners: {                 block: true             },             process: true,             separator: '\n /* ----- */ \n',             banner: '<%= meta.banner %>'         },         dist: {             src: ['src/utility.js', 'src/mainclass.js', 'src/viewclass.js', 'src/exif.js'],             dest: 'build/viewer.js'         }     }, 

i put following line utility.js:

viewer.build_date = '<% grunt.template.today("yyyy-mm-dd") %>'; 

i expected string replaced current date empty after concatenation.

viewer.build_date = ''; 

grunt version 0.4.1 used.

i think, missing '=' before grunt sign given below.

<%= grunt.template.today("yyyy-mm-dd") %>  

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -