gulp-rsync icon indicating copy to clipboard operation
gulp-rsync copied to clipboard

Sync just files from directory, not directory itself

Open FNGR2911 opened this issue 8 years ago • 3 comments

Hi everybody! Maybe I'm too stupid to read the docs, but is it possible to rsync just the files from a directory 'dist/.' to a destination without the directory itself? I don't need the 'dist' folder on my server.

Thank you :)

FNGR2911 avatar Jan 19 '18 10:01 FNGR2911

Hello, don't know if you worked this out, but I did this which worked:

Say I have a dist folder like this:

dist/app-name

I passed the following to gulp.src:

['**/.', 'app-name']

after changing diretory to dist/app-name like so:

process.chdir('dist/app-name')

So the full code is (given dist/app-name):

process.chdir('dist/app-name')
return gulp.src(['**/.', 'app-name'])
        .pipe(rsync(rsyncConf));

NB: the period in the match path ensures things like .htaccess are included

HTH

ghost avatar Nov 19 '18 03:11 ghost

@FNGR2911 see my previous comment but also forgot to add that regarding .htaccess, this needs to be added to angular.json like:


            "assets": [
              "src/favicon.ico",
              "src/.htaccess",
              "src/assets"
            ],

ghost avatar Nov 19 '18 04:11 ghost

@FNGR2911 Hello, I don't know if could solve your issue, but you need to set root property with the value of dist, so the dist content will be published under the destination.

Example:

   src('dist/**').pipe(rsync({
     root: 'dist',
   }))

diegomarcuz avatar Jan 11 '21 21:01 diegomarcuz