Skip to content

Commit

Permalink
Organize const functions
Browse files Browse the repository at this point in the history
- build, serve and deploy functions
- default gulp function is now serve
  • Loading branch information
renatodeleao committed Oct 6, 2016
1 parent 9ffc70e commit a4137c6
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 7 deletions.
66 changes: 59 additions & 7 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,45 @@ export function paniniRebuild() {
};


export function watch(done) {
/*
* Local server using BrowserSync
*/
export function browserSyncServer(done){
var config = {
server: {
baseDir: paths.appRoot.dest,
}
}
//run TUNNEL=true gulp to start public tunnel url to share.
if (process.env.TUNNEL === 'true') {
config.tunnel = "";
}

browserSync.init(config);
done()
}



/*
* Listen for Changes
*/
export function watch() {
gulp.watch(paths.images.src, images);
gulp.watch(paths.fonts.src, fonts);
gulp.watch(paths.styles.src, styles);
gulp.watch(paths.scripts.src, scripts);
gulp.watch(paths.views.src, paniniRebuild());

$.util.log($.util.colors.bgGreen('Watching for changes...'));
done()
}


/*
* Build
*
* Create a deployable folder
*/
const build = gulp.series(
clean,
gulp.parallel(
Expand All @@ -189,11 +216,36 @@ const build = gulp.series(
)
);

export { build };

const serve = gulp.series( build, gulp.parallel(watch, browserSyncServer));
export { serve };
/*
* Export a default task
* Serve
*
* Serve the deployable folder watch for changes and start a dev server
*/
const serve = gulp.series(
build,
gulp.parallel(watch, browserSyncServer)
);


/*
* Deploy To gitHubPages
*
* Serve the deployable folder watch for changes and start a dev server
*/
export default build;
const deploy = gulp.series(
build,
function(){
return gulp.src(appRoot.dest)
.pipe(ghPages());
}
);




/* Export const functions */
export { build, serve, deploy};

/* Default gulp task as serve*/
export default serve;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"gulp-clean-css": "^2.0.13",
"gulp-concat": "^2.6.0",
"gulp-eslint": "^3.0.1",
"gulp-gh-pages": "^0.5.4",
"gulp-htmlmin": "^3.0.0",
"gulp-if": "^2.0.1",
"gulp-imagemin": "^3.0.3",
Expand Down

0 comments on commit a4137c6

Please sign in to comment.