outaTiME / grunt-replace

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

how to replace files in different folders #85

Closed reacher-lu closed 9 years ago

reacher-lu commented 9 years ago

@outaTiME just like this issue https://github.com/outaTiME/grunt-replace/issues/67 , my problem is,

origin files

app/ ├── index1.html ├── index2.html ├── v1 │ └── 1.html │ └── 2.html

i want to replace files like this

dist/ ├── index1.html ├── index2.html ├── v1 │ └── 1.html │ └── 2.html

when i use


options: { 
  // patterns: ...
},
files: [{
  expand: true, 
  cwd: 'app/',
  src: '**/*.html', 
  dest: 'dist/'
}]

after run grunt, the files in dist

dist/ ├── index1.html ├── index2.html ├── 1.html ├── 2.html

How do I solve this problem? thx

outaTiME commented 9 years ago

hi pal, strange i make a local test in that way:

replace: {
  dist: {
    options: {
      variables: {
        version: '<%= pkg.version %>',
        build: '<%= build %>',
        product: '<%= product %>',
        copyrightNotice: '<%= copyrightNotice %>',
        environment: '<%= grunt.config.get(\'environment\') %>'
      },
      force: true
    },
    files: [
      {expand: true, cwd: 'assets/pages', src: ['**/*.json'], dest: 'build/templates'}
    ]
  }
},

And internal directories from assets/pages are preserved in dest, which version of grunt / grunt-replace are you using ??

reacher-lu commented 9 years ago

uh..the version of grunt/grunt-replace I used is too old, When I upgraded my grunt/grunt-replace ,it works very well,thank you very much!!