gruntjs - How can I use two "replace" tasks from "grunt-replace" and "grunt-text-replace" in same gruntfile.js -


in gruntfile use grunt-replace replace tags starting @@. want find custom strings , replace them too. found grunt-text-replace suitable that. tested demo project. in case grunt-replace , grunt-text-replace has same task name "replace". possible use 2 in same gruntfile?

if yes, how?

grunt-text-replace code:

replace: {                                                                        bust: {                                                                          src: ['dist/*.html'],                                                        overwrite: true,                 // overwrite matched source files           replacements: [                                                                  {                                                                                from: '.js',                                                                  to: function () {                                                                timestamp = '.' + new date().gettime() ;                                     return timestamp + '.js';                                                }                                                                        }                                                                        ]                                                                        }                                                                        }         

grunt-replace code:

replace: {     prod:{                                                                                                        options: {                                                                                                     patterns: [{                               match:'stylelink',                                                                                    replacement: "<link rel='stylesheet' type='text/css'  id='css' href='css/style.css'>"                      }]         },          files: [{expand: true, flatten: true, src: ['app/index.html'], dest: '<%= dirs.dest %>'}]         }      } 

one way rename task before loading second plugin. take at: grunt.task.renametask

also here example: stackoverflow


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -