Skip to content

Commit

Permalink
Merge pull request #122 from Novicell/#98_FTP_task
Browse files Browse the repository at this point in the history
fixed #98 ftp task
  • Loading branch information
Dan9boi authored Mar 31, 2017
2 parents d4d8923 + 9f81e3c commit 186039e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ The following tasks are available:
* `images` - Minifies images defined in: gulp-config.json > bundles > {bundleName} > images
* `icons` - Minifies and generates a svg sprite, from the icons defined in: gulp-config.json > bundles > {bundleName} > icons
* `copy` - Copies the fonts defined in: gulp-config.json > bundles > {bundleName} > fonts
* `deploy` - Uploads file via FTP, configuration can be found in gulp/config.js
* `html` - Will run through the html folder (not subfolders by default), looking for the `@@include`, to then partially replace them with the path. To learn more, go to the [HTML task in details](#HTML-task-in-details)
* `watch`

Expand Down
11 changes: 9 additions & 2 deletions gulp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = (function () {
var projectPath = "./"; // path for the source files
var webPath = projectPath + ""; // path for the website - usually path to livereload views, and used for distPath
var vendorPath = projectPath + "node_modules/"; // path for vendor scripts
var distPath = webPath + "dist/"; // path for production files
var distPath = webPath + "dist/test/"; // path for production files
var cleanPaths = [distPath]; // files/folders to be removed with "clean"-task

return {
Expand Down Expand Up @@ -91,6 +91,13 @@ module.exports = (function () {
projectPath + 'less/**/*.less'
],

// ------------- Deploy task --------
deployHost: "",
deployUser: "",
deployPass: "",
deployDest: "/public_html/",
deployGlobs: [ distPath + '**' ],

// ------------- Copy on build --------
buildCopy: [{
from: projectPath + "fonts/**/*",
Expand All @@ -100,7 +107,7 @@ module.exports = (function () {

// ------------- Tasks -------------
loadTasks: [
"styles", "scripts", "images", "icons", "copy", "watch", "build", "html"
"styles", "scripts", "images", "icons", "copy", "watch", "build", "html", "deploy"
],
buildTasks: [
"styles", "scripts", "images", "icons", "copy"
Expand Down
24 changes: 24 additions & 0 deletions gulp/tasks/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

const gulp = require('gulp');
const config = require('../config.js');
var plugins = require('gulp-load-plugins')();
var gutil = require('gulp-util');
var ftp = require('vinyl-ftp');

gulp.task('deploy', function () {
var conn = ftp.create({
host: config.deployHost,
user: config.deployUser,
password: config.deployPass,
parallel: 10,
log: gutil.log
// secure: true
});

// using base = '.' will transfer everything to /public_html correctly
// turn off buffering in gulp.src for best performance
return gulp.src(config.deployGlobs, { base: config.distPath, buffer: false } )
.pipe(conn.newer(config.deployDest)) // only upload newer files
.pipe(conn.dest(config.deployDest));
});

0 comments on commit 186039e

Please sign in to comment.