Here is my grunt file which is not showing error but not working properly, if i remove dev and prod from 'string-replace' and have only one 'string-replace', then its work.Suggest any solution for multiple environmet.
//Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
'string-replace': {
dev : {
inline: {
files: {
'index.html':'index.html'
},
options: {
replacements: [
{
pattern: '<!--start PROD imports-->',
replacement: '<!--start PROD imports'
},
{
pattern: '<!--end PROD imports-->',
replacement: 'end PROD imports-->'
},
{
pattern: '<!--start DEV imports',
replacement: '<!--start DEV imports-->'
},
{
pattern: 'end DEV imports-->',
replacement: '<!--end DEV imports-->'
}
]
}
}
},
prod : {
inline: {
files: {
'index.html':'index.html'
},
options: {
replacements: [
{
pattern: '<!--start PROD imports',
replacement: '<!--start PROD imports-->'
},
{
pattern: 'end PROD imports-->',
replacement: '<!--end PROD imports-->'
},
{
pattern: '<!--start DEV imports-->',
replacement: '<!--start DEV imports'
},
{
pattern: '<!--end DEV imports-->',
replacement: 'end DEV imports-->'
}
]
}
}
}
}
});
grunt.loadNpmTasks('grunt-string-replace');
grunt.registerTask('default', ['string-replace:dev']);
grunt.registerTask('prod', ['string-replace:prod']);
};
I need to have it for dev and production both.
via Shubham Tripathi
No comments:
Post a Comment