forked from truedigital/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
53 lines (43 loc) · 1.75 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// === GULP MAGIC
// ============================================================================
var argv = require('yargs').argv,
gulp = require('gulp'),
gutil = require('gulp-util'),
path = require('./gulp/settings/paths')
// BROWSER SYNC
var browserSync = require('browser-sync'),
reload = browserSync.reload;
// LOAD PLUGINS
var plugins = require("gulp-load-plugins")({
pattern: ['gulp-*', 'gulp.*'],
replaceString: /\bgulp[\-.]/
});
// === TASKS
// ==============================================================================
require('./gulp/tasks/styles')(gulp, gutil, plugins, browserSync);
require('./gulp/tasks/scripts')(gulp, gutil, plugins, browserSync);
require('./gulp/tasks/templates')(gulp, gutil, plugins, browserSync);
require('./gulp/tasks/browser-sync')(gulp, browserSync);
require('./gulp/tasks/sprites')(gulp, plugins, browserSync);
require('./gulp/tasks/modernizr')(gulp, plugins, browserSync);
// GULP
//==============================================================================
gulp.task('default', function () {
gulp.start('styles', 'scripts', 'templates');
});
gulp.task('build' , function () {
gulp.start('modernizr');
});
gulp.task('watch', ['default', 'browser-sync'], function () {
watchFiles();
});
gulp.task('watch-templates', ['default', 'browser-sync-templates'], function () {
watchFiles();
});
function watchFiles(){
gulp.watch(path.to.scss.files, ['styles']);
gulp.watch(path.to.js.partials, ['scripts']);
gulp.watch(path.to.templates.files, ['templates', browserSync.reload]);
gulp.watch(path.to.templates.partials, ['templates', browserSync.reload]);
gulp.watch(path.to.svg.files, ['sprites', browserSync.reload]);
}