outaTiME / grunt-replace

Replace text patterns with applause.
MIT License
411 stars 47 forks source link

Multiple destination option not available #91

Closed sureshpattu closed 8 years ago

sureshpattu commented 8 years ago

HI All, This is my code

replace: {
            dist: {
                options: {
                    patterns: [
                        {
                            match: /bundles/g,
                            replacement: function () {
                                return cdnURL + '/bundles'; 
                            }
                        },
                        {
                            match: /\/img/g,
                            replacement: function () {
                                return cdnURL + '/img';
                            }
                        }
                    ]
                },
                files: [
                    {
                        expand: true,
                        flatten: true,
                        src: ['dist/index.html'],
                        dest: ['dist/']
                    }, {
                        expand: true,
                        flatten: true,
                        src: ['dist/public/bundles/szmtpl.js'],
                        dest: ['dist/bundles/']
                    }
                ]
            }
        },

I want paste the compiled files to different destination. How to achieve that here

outaTiME commented 8 years ago

Hi,

I dont understand what you are looking for ...

In the current example you define two pattern replacements, this patterns will try to match in the file definitions right ?

in dist/index.html -> look for (/bundles/g and /\/img/g) in dist/public/bundles/szmtpl.js -> look for (/bundles/g and /\/img/g)

after replacement performs, copy dist/index.html to dist(probably override here) and dist/public/bundles/szmtpl.js to dist/bundles/

sureshpattu commented 8 years ago

Yes Yes thats what I want. But its not happening here.

outaTiME commented 8 years ago

Please, you can send me the output generated in stdout when execute the grunt replace ?

sureshpattu commented 8 years ago

This is the error msg

Running "replace:dist" (replace) task
Warning: Path must be a string. Received [ 'dist/' ] Use --force to continue.
sureshpattu commented 8 years ago

Hey sorry man, My bad I was trying like this

files: [
                    {
                        expand: true,
                        flatten: true,
                        src: ['dist/index.html','dist/public/bundles/szmtpl.js'],
                        dest: ['dist/','dist/bundles/']
                    }
                ]

It suppose to be like this then it works fine

files: [
                    {
                        expand: true,
                        flatten: true,
                        src: ['dist/index.html'],
                        dest: 'dist/'
                    }, {
                        expand: true,
                        flatten: true,
                        src: ['dist/public/bundles/szmtpl.js'],
                        dest: 'dist/bundles/'
                    }
                ]

Thanks man for the reply :+1:

outaTiME commented 8 years ago

ok, no prob !!!

closing now ...