jerrysu / gulp-rsync

Gulp plugin for deploying files via rsync
119 stars 51 forks source link

Sync just files from directory, not directory itself #52

Open FNGR2911 opened 6 years ago

FNGR2911 commented 6 years ago

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 :)

ghost commented 5 years ago

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 commented 5 years ago

@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"
            ],
diegomarcuz commented 3 years ago

@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',
   }))