Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Uses gulp.series & gulp.parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
lejoe committed Nov 11, 2015
1 parent bbe7fea commit 15c715d
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 74 deletions.
21 changes: 7 additions & 14 deletions gulp/tasks/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ module.exports = function (gulp, $, config) {
var serverBase = config.basePaths.dest;
var scriptFiles = [config.appFiles.scripts];
var stylesFiles = [config.appFiles.styles];
var pagesFiles = [config.appFiles.pages];
var layoutFiles = config.appFiles.layouts;
var pagesFiles = [config.appFiles.pages, config.appFiles.layouts];
var contentSrcFiles = config.appFiles.content;
var gulpFiles = config.gulpFiles;
var logosFiles = config.appFiles.logos;
Expand All @@ -33,25 +32,19 @@ module.exports = function (gulp, $, config) {
browserSync.start(serverBase);

// Watching Scripts
gulp.watch(scriptFiles, ['build:scripts']);
gulp.watch(scriptFiles, gulp.parallel('build:scripts'));

// Watching Styles
gulp.watch(stylesFiles, ['build:styles']);
gulp.watch(stylesFiles, gulp.parallel('build:styles'));

// Watching Pages
gulp.watch([pagesFiles, layoutFiles], ['build:pages', reload]);
gulp.watch(pagesFiles, gulp.series('build:pages', reload));

// Watching Content
gulp.watch(contentSrcFiles, ['build:pages', reload]);
gulp.watch(contentSrcFiles, gulp.series('build:content', 'build:pages', reload));

// Watching Assets
gulp.watch(logosFiles, ['build:assets']);
gulp.watch(faviconsFiles, ['build:assets']);
gulp.watch(imagesFiles, ['build:assets']);
gulp.watch(fontsFiles, ['build:assets']);

// Watch Gulp tasks
gulp.watch(gulpFiles, ['serve']);
// // Watching Assets
gulp.watch([logosFiles, faviconsFiles, imagesFiles, fontsFiles], gulp.parallel('build:assets'));
};

task.description = 'Serve the build folder';
Expand Down
124 changes: 64 additions & 60 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,88 @@
'use strict';
var gulp = require('gulp');
var config = require('./gulp/config')();
var runSequence = require('run-sequence');
var t = require('./gulp/utils/tasksHelpers')(gulp);

t.configure(config);

//////////
// Main //
//////////
gulp.task('default',
'Build and serve the app',
['serve', 'tasks']);
///////////////
// Build //
///////////////

gulp.task('build',
'Build the app',
function(cb) {
runSequence('clean',
['build:pages', 'build:assets', 'build:styles', 'build:scripts'],
cb);
});
// Cleans the build folder
gulp.task('clean', t.getTask('clean'));

gulp.task('serve',
'Serve the build folder',
['build'],
t.getTask('serve'));
// Moves all the assets to the build
gulp.task('build:assets', t.getTask('assets'));

gulp.task('deploy',
'Deploys to testing',
t.getTask('deploy'));
// Concatenates all the content files
gulp.task('build:content', t.getTask('content'));

// Generate all pages from the jade files
gulp.task('build:pages', t.getTask('pages'));

gulp.task('test',
'Tests the built project in terms of accessibility.',
['test:accessibility']);
// Generate all stylesheets from the sass files
gulp.task('build:styles', t.getTask('styles'));

// Move all javscript files to the build
gulp.task('build:scripts', t.getTask('scripts'));

gulp.task(
'build',
gulp.series(
'clean',
gulp.parallel(
gulp.series(
'build:content',
'build:pages'
),
'build:assets',
'build:styles',
'build:scripts'
)
)
);

///////////////
// Secondary //
///////////////

// Move all javscript files to the build
gulp.task('build:scripts',
false,
t.getTask('scripts'));
//////////
// Test //
//////////

// Generate all stylesheets from the sass files
gulp.task('build:styles',
false,
t.getTask('styles'));
// Moves all the assets to the build
gulp.task('test:accessibility', t.getTask('accessibility'));

// Concatenates all the content files
gulp.task('build:content',
false,
t.getTask('content'));
// Tests the built project in terms of accessibility.
gulp.task(
'test',
gulp.series(
'build',
'test:accessibility'
)
);

// Generate all pages from the jade files
gulp.task('build:pages',
false,
['build:content'],
t.getTask('pages'));

// Moves all the assets to the build
gulp.task('build:assets',
false,
t.getTask('assets'));
////////////
// Deploy //
////////////

gulp.task('deploy', t.getTask('deploy'));

// Moves all the assets to the build
gulp.task('test:accessibility',
false,
['build'],
t.getTask('accessibility'));

// Cleans the build folder
gulp.task('clean',
false,
t.getTask('clean'));
/////////////
// Others //
/////////////

// Serve the build folder
gulp.task('serve', t.getTask('serve'));

// Lints the gulp tasks
gulp.task('tasks',
false,
t.getTask('tasks'));
gulp.task('tasks', t.getTask('tasks'));

// What happens when just running 'gulp'
gulp.task(
'default',
gulp.series(
'build',
'serve'
)
);

0 comments on commit 15c715d

Please sign in to comment.