javascript - Can I use grunt to set a property value in a json file? -


still learning ropes of grunt , can't find solution this. have config file, config.json data.

when run specific grunt task want increment value in config.json file. i've been able find lot of information on how read file nothing far on changing value.

thanks.

you can use https://github.com/eruizdechavez/grunt-string-replace replace string , save file

'string-replace': {   dist: {     files: {       'dest/': 'src/**',       'prod/': ['src/*.js', 'src/*.css'],     },     options: {       replacements: [{         pattern: /\/(asdf|qwer)\//ig,         replacement: '"$1"'       }, {         pattern: ',',         replacement: ';'       }]     }   } } 

with grunt plugin u can substitute regex pattern (or simple string) replacement

the steps make final json are:


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -