outaTiME / grunt-replace

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

How to dynamically replace all files inside a certain folder? #67

Closed LoeiFy closed 9 years ago

LoeiFy commented 9 years ago

origin files

app/
├── v1
│   └── 1.html
│   └── 2.html
├── v2
│   └── 3.html
│   └── 4.html

i want to replace files like this

dist/
├── v1
│   └── 1.html
│   └── 2.html
├── v2
│   └── 3.html
│   └── 4.html

my Gruntfile, config just like grunt-htmlmin

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

after run grunt, the files in dist

dist/
│   └── 1.html
│   └── 2.html
│   └── 3.html
│   └── 4.html

why? how to separate? thanks

outaTiME commented 9 years ago

Hi pal,

These are basis from grunt, not from replace plugin ... do you try to remove the flatten flag ... try the following:

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

Here the explanation: http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

LoeiFy commented 9 years ago

thx! @outaTiME, it works , good plugin