1- var gulp = require ( 'gulp' ) ;
2- var browserSync = require ( 'browser-sync' ) ;
3- var args = require ( 'yargs' ) . argv ;
4- var $ = require ( 'gulp-load-plugins' ) ( { lazy : true } ) ;
1+ var gulp = require ( 'gulp' ) ;
2+ var browserSync = require ( 'browser-sync' ) ;
3+ var args = require ( 'yargs' ) . argv ;
4+ var $ = require ( 'gulp-load-plugins' ) ( { lazy : true } ) ;
55
66var config = {
7- sassSrc : [ './sass/**/*.sass' , './sass/**/*.scss' ] ,
8- sassDist : './' ,
9- jsSrc : './js/**/*.js'
7+ sassSrc : [ './sass/**/*.sass' , './sass/**/*.scss' ] ,
8+ sassDist : './' ,
9+ jsSrc : './js/**/*.js'
1010} ;
1111
12- gulp . task ( 'default' , [ 'styles' , 'watch' , 'browserSync' ] ) ;
12+ gulp . task ( 'default' , [ 'styles' , 'watch' , 'browserSync' ] ) ;
1313
14- gulp . task ( 'styles' , function ( ) {
14+ gulp . task ( 'styles' , function ( ) {
15+ return gulp . src ( config . sassSrc )
16+ . pipe ( $ . sourcemaps . init ( ) )
17+ . pipe ( $ . autoprefixer ( { browsers : [ 'last 15 versions' ] } ) )
18+ . on ( 'error' , function ( error ) {
19+ log ( '[ERROR] Autoprefixer : ' + error . message ) ;
20+ } )
21+ . pipe ( $ . sass ( { style : 'compressed' } ) )
22+ . on ( 'error' , function ( error ) {
23+ log ( '[ERROR] Styles : ' + error . message ) ;
24+ } )
25+ . pipe ( $ . sourcemaps . write ( './' ) )
26+ . pipe ( gulp . dest ( config . sassDist ) )
27+ ;
28+ } ) ;
1529
16- return gulp . src ( config . sassSrc )
17- . pipe ( $ . sourcemaps . init ( ) )
18- . pipe ( $ . autoprefixer ( { browsers : [ 'last 15 versions' ] } ) )
19- . on ( 'error' , function ( error ) {
20- log ( '[ERROR] Autoprefixer : ' + error . message ) ;
21- } )
22- . pipe ( $ . sass ( { style : 'compressed' } ) )
23- . on ( 'error' , function ( error ) {
24- log ( '[ERROR] Styles : ' + error . message ) ;
25- } )
26- . pipe ( $ . sourcemaps . write ( './' ) )
27- . pipe ( gulp . dest ( config . sassDist ) )
28- ;
29-
30- } ) ;
31-
32- gulp . task ( 'bsReload' , function ( ) {
30+ gulp . task ( 'bsReload' , function ( ) {
3331 browserSync . reload ( ) ;
34- } ) ;
32+ } ) ;
3533
3634// Set the proxy.
37- gulp . task ( 'browserSync' , function ( ) {
35+ gulp . task ( 'browserSync' , function ( ) {
3836
3937 var options = {
40- proxy : "elysee.dev" ,
41- files : [
38+ proxy : "elysee.dev" ,
39+ files : [
4240 './**/*.css' ,
4341 './js/**/*.js' ,
4442 './**/*.php'
4543 ] ,
46- ghostMode : {
47- clicks : true ,
48- location : true ,
49- forms : true ,
50- scroll : true
44+ ghostMode : {
45+ clicks : true ,
46+ location : true ,
47+ forms : true ,
48+ scroll : true
5149 } ,
52- injectChanges : true ,
53- notify : true ,
54- reloadDelay : 0 //1000
50+ injectChanges : true ,
51+ notify : true ,
52+ reloadDelay : 0 //1000
5553 } ;
5654
57- browserSync . init ( null , options ) ;
58- } ) ;
55+ browserSync . init ( null , options ) ;
56+ } ) ;
5957
60- gulp . task ( 'scripts' , function ( ) {
58+ gulp . task ( 'scripts' , function ( ) {
6159 // todo should add stuff here...
62- log ( 'scripts' ) ;
63- } ) ;
60+ log ( 'scripts' ) ;
61+ } ) ;
6462
65- gulp . task ( 'watch' , [ 'browserSync' ] , function ( ) {
66- gulp . watch ( config . sassSrc , [ 'styles' , 'bsReload' ] ) ;
67- gulp . watch ( config . jsSrc , [ 'scripts' , 'bsReload' ] ) ;
68- } ) ;
63+ gulp . task ( 'watch' , [ 'browserSync' ] , function ( ) {
64+ gulp . watch ( config . sassSrc , [ 'styles' , 'bsReload' ] ) ;
65+ gulp . watch ( config . jsSrc , [ 'scripts' , 'bsReload' ] ) ;
66+ } ) ;
6967
70- function log ( msg ) {
71- if ( typeof ( msg ) === 'object' ) {
72- for ( var item in msg ) {
73- if ( msg . hasOwnProperty ( item ) ) {
74- $ . util . log ( $ . util . colors . blue ( msg [ item ] ) ) ;
68+ function log ( msg ) {
69+ if ( typeof ( msg ) === 'object' ) {
70+ for ( var item in msg ) {
71+ if ( msg . hasOwnProperty ( item ) ) {
72+ $ . util . log ( $ . util . colors . blue ( msg [ item ] ) ) ;
7573 }
7674 }
7775 } else {
78- $ . util . log ( $ . util . colors . blue ( msg ) ) ;
76+ $ . util . log ( $ . util . colors . blue ( msg ) ) ;
7977 }
8078}
0 commit comments