-
-
Save atwellpub/a742227e21efd17c9a04 to your computer and use it in GitHub Desktop.
* watch cta's shared folder for changes and mirror it to /_inbound-pro/core/shared
* watch cta's analytics source files and compile changes locally
* launch the node server. sudo gulp start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'), | |
karma = require('gulp-karma'), | |
jshint = require('gulp-jshint'), | |
stylish = require('jshint-stylish'), | |
header = require('gulp-header'), | |
concat = require('gulp-concat'), | |
uglify = require('gulp-uglify'), | |
plumber = require('gulp-plumber'), | |
clean = require('gulp-clean'), | |
rename = require('gulp-rename'), | |
copy = require('gulp-copy'), | |
markdox = require("gulp-markdox"), | |
gulpIgnore = require('gulp-ignore'), | |
exec = require('exec'), | |
nodemon = require('gulp-nodemon'), | |
//phplint = require('phplint').lint, | |
package = require('./package.json'); | |
/* load development process */ | |
gulp.task('start' , ['watch','server'] ); | |
/** | |
* Watch CTA Shared File for changes | |
*/ | |
gulp.task('watch', function() { | |
gulp.watch('cta/shared/**', ['sync-shared-pro','sync-shared-leads','sync-shared-lp']); | |
gulp.watch('cta/shared/assets/js/frontend/analytics-src/*.js', ['default']); | |
}); | |
/** | |
* Loads node server | |
*/ | |
gulp.task('server', function () { | |
nodemon({ | |
script: './../../../inbound-api/server.js' | |
, ext: 'js html' | |
, env: { 'NODE_ENV': 'development' } | |
, ignore: ['**'] | |
}) | |
}) | |
/** | |
* watch cta shared folder for changes | |
* | |
*/ | |
gulp.task('sync-shared-pro', function () { | |
return gulp.src(['./cta/shared/**']) | |
.pipe(gulp.dest('./_inbound-pro/core/shared/')); | |
}); | |
gulp.task('sync-shared-leads', function () { | |
return gulp.src(['./cta/shared/**']) | |
.pipe(gulp.dest('./leads/shared/')); | |
}); | |
gulp.task('sync-shared-lp', function () { | |
return gulp.src(['./cta/shared/**']) | |
.pipe(gulp.dest('./landing-pages/shared/')); | |
}); | |
/** | |
* Task to sync lp to pro | |
*/ | |
gulp.task('sync-lp', function () { | |
return gulp.src(['../landing-pages/**']).pipe(gulp.dest('./core/landing-pages/')); | |
}); | |
/** | |
* Task to sync cta to pro | |
*/ | |
gulp.task('sync-cta', function () { | |
return gulp.src(['../cta/**']).pipe(gulp.dest('./core/cta/')); | |
}); | |
/** | |
* Task to sync leads to pro | |
*/ | |
gulp.task('sync-leads', function () { | |
return gulp.src(['../leads/**']) | |
.pipe(gulp.dest('./core/leads/')); | |
}); | |
/** | |
* Task to move core/cta/shared to core/shared | |
*/ | |
gulp.task('move-shared', function () { | |
return gulp.src(['./core/cta/shared/**']) | |
//.pipe(gulpIgnore.exclude(condition)) | |
.pipe(gulp.dest('./core/shared/')); | |
}); | |
function getPath(path){ | |
var removeFiles = ['./core/'+path+'/node_modules/', | |
'./core/'+path+'/shared/', | |
'./core/'+path+'/*.jpg', | |
'./core/'+path+'/*.js', | |
'./core/'+path+'/*.sh', | |
'./core/'+path+'/*.json', | |
'./core/'+path+'/*.ini', | |
'./core/'+path+'/*.png', | |
'./core/'+path+'/*.travis.yml', | |
'./core/'+path+'/*.dist', | |
'./core/'+path+'/*.md', | |
'./core/'+path+'/*.txt']; | |
return removeFiles; | |
} | |
gulp.task('clean-lp', ['sync-lp'], function () { | |
var removeFiles = getPath('landing-pages'); | |
return gulp.src(removeFiles, {read: false}) | |
.pipe(clean()); | |
}); | |
gulp.task('clean-leads', ['sync-leads'], function () { | |
var removeFiles = getPath('leads'); | |
return gulp.src(removeFiles, {read: false}) | |
.pipe(clean()); | |
}); | |
gulp.task('clean-cta', ['sync-cta', 'move-shared'], function () { | |
var removeFiles = getPath('cta'); | |
return gulp.src(removeFiles, {read: false}) | |
.pipe(clean()); | |
}); | |
/* Sync all core plugins */ | |
gulp.task('sync', ['clean-lp', 'clean-leads', 'clean-cta']); | |
gulp.task('default', [ | |
'lint', | |
'clean', | |
'scripts', | |
'generateDocs' | |
]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment