grunt-sftp-deploy icon indicating copy to clipboard operation
grunt-sftp-deploy copied to clipboard

exclusions and subfolders

Open ivoba opened this issue 10 years ago • 1 comments

Not sure of its wrongly described in the readme, but i couldnt get subfolders like dist/tmp get excluded unless i changed it to ./dist/tmp.

In the grunt-ftp-deploy project there was a PR for changing relative pathes to prefxied pathes in the docs: https://github.com/zonak/grunt-ftp-deploy/pull/54/files

This possibly applies to here as well.

ivoba avatar Nov 04 '14 16:11 ivoba

seriously? no response since 2014?

anyway, just in case anyone's still looking (like me), and i have to figure this out myself. it's best to use full paths (/path/to/folder) instead of relative paths (path/to/folder) when handling subfolders. just like how i configured it below.

keep the full path of your project somewhere in a config file. or your exclusion list will get really long.

"base_dir": "/Users/username/Sites/projectname"

load the config file inside grunt.initConfig.

conf: grunt.file.readJSON('config.json')

then append the <%= conf.base_dir %> var above to the list:

'sftp-deploy': {
    build: {
        auth: {
            host: '<%= conf.remote_host %>',
            port: 22,
            authKey: '<%= conf.env %>'
        },
        src: '<%= conf.base_dir %>',
        dest: '<%= conf.remote_dir %>',
        exclusions: [
            '<%= conf.base_dir %>/**/.DS_Store',
            '<%= conf.base_dir %>/application/cache',
            '<%= conf.base_dir %>/node_modules',
            '<%= conf.base_dir %>/public/assets/js/src',
            '<%= conf.base_dir %>/public/assets/scss',
            '<%= conf.base_dir %>/public/prototype',
            '<%= conf.base_dir %>/.sass-cache',
            '<%= conf.base_dir %>/.bowerrc',
            '<%= conf.base_dir %>/.editorconfig',
            '<%= conf.base_dir %>/.eslintrc',
            '<%= conf.base_dir %>/.ftppass*',
            '<%= conf.base_dir %>/.git',
            '<%= conf.base_dir %>/.gitattributes',
            '<%= conf.base_dir %>/.gitignore',
            '<%= conf.base_dir %>/.htmlhintrc',
            '<%= conf.base_dir %>/.sass-lint.yml',
            '<%= conf.base_dir %>/bower.json',
            '<%= conf.base_dir %>/config.json*',
            '<%= conf.base_dir %>/Gemfile*',
            '<%= conf.base_dir %>/Gruntfile.js',
            '<%= conf.base_dir %>/package.json'
        ],
        concurrency: 4,
        progress: true
    }
}

additional tips, If you want to ignore just the contents of a folder, but keep the folder intact on the remote server. use the star (*):

/path/to/folder/*

if you want to completely exclude it. do it like this:

/path/to/folder

rizkysyazuli avatar Apr 09 '17 06:04 rizkysyazuli