Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Destination Folder Adds Source Directory #23

Closed
nmynarcik opened this issue Sep 15, 2014 · 4 comments
Closed

Destination Folder Adds Source Directory #23

nmynarcik opened this issue Sep 15, 2014 · 4 comments

Comments

@nmynarcik
Copy link

When using:

config: {
    dist: 'dist/',
    prod: 'prod/'
}
files: {
      '<%= config.prod %>': '<%= config.dist %>*'
},

The result gives a folder structure of:

dist
--filename.html
prod
--dist
-----filename.html

Is there any way to prevent it from creating the source directory as a subdirectory to the destination folder?

@eruizdechavez
Copy link
Owner

Yes, there is a way, but I just found that even tho it works, it is reporting an error. Let me fix it and then I'll post an example here.

@eruizdechavez
Copy link
Owner

v0.2.8 should fix the problem, try using something like the example below (replace my replace with your replace patterns)

module.exports = function(grunt) {

  grunt.initConfig({
    config: {
      dist: 'dist',
      prod: 'prod'
    },
    'string-replace': {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= config.dist %>',
          src: '**/*',
          dest: '<%= config.prod %>'
        }],
        options: {
          replacements: [{
            pattern: 'hello',
            replacement: 'howdy'
          }]
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-string-replace');

  grunt.registerTask('default', ['string-replace']);
};

@nmynarcik
Copy link
Author

That works! Thank you!

@eruizdechavez
Copy link
Owner

Thanks for reporting it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants