Revisions
-
rc1 revised this gist
Jan 18, 2017 . No changes.There are no files selected for viewing
-
rc1 revised this gist
Jan 18, 2017 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -204,10 +204,8 @@ gulp.task('watch', function () { .on( 'change', browserSync.reload ); gulp.watch( 'jade/**/*.php.jade', [ 'jade-php' ] ) .on( 'change', browserSync.reload ); gulp.watch( './sass/*.scss', [ 'sass' ] ); gulp.watch( 'less/**/*.less', [ 'less' ] ); gulp.watch( 'js-concat/**/*', [ 'js-concat' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'js/**/*', [ 'js' ] ) -
rc1 revised this gist
Dec 19, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -159,7 +159,7 @@ gulp.task( 'js', function () { // Sass // ---- gulp.task( 'sass', function () { return gulp.src( './sass/*.scss' ) .pipe( plumber() ) .pipe( sass().on( 'error', sass.logError ) ) .pipe( autoprefixer( { browsers: [ 'last 3 versions' ] }) ) @@ -171,7 +171,7 @@ gulp.task( 'sass', function () { // Less // ---- gulp.task( 'less', function () { return gulp.src( './less/*.less' ) .pipe( plumber() ) .pipe( gulpif( USE_CSS_SOURCEMAPS, sourcemaps.init())) .pipe( less() ) @@ -204,7 +204,7 @@ gulp.task('watch', function () { .on( 'change', browserSync.reload ); gulp.watch( 'jade/**/*.php.jade', [ 'jade-php' ] ) .on( 'change', browserSync.reload ); gulp.watch( './sass/*.scss', [ 'sass' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'less/**/*.less', [ 'less' ] ) .on( 'change', browserSync.reload ); -
rc1 revised this gist
Dec 19, 2016 . 1 changed file with 25 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // Modules // ======= // // gulp gulp-plumber gulp-concat gulp-if gulp-rename gulp-sourcemaps browser-sync gulp-csso gulp-less gulp-autoprefixer gulp-uglify gulp-babel babel-preset-es2015 gulp-jade git://github.com/oroce/gulp-jade-php#v2.0.0-0 gulp-sass // Gulp // ---- @@ -14,14 +14,19 @@ var rename = require( 'gulp-rename' ); // Watch // ----- var browserSync = require( 'browser-sync' ).create(); // Sass // ---- var sass = require( 'gulp-sass' ); // Less // ---- var less = require( 'gulp-less' ); // CSS // --- var csso = require( 'gulp-csso' ); var autoprefixer = require( 'gulp-autoprefixer' ); // Jade // ---- var jade = require( 'gulp-pug' ); // JadePHP // ------- var jadePhp = require( 'gulp-jade-php' ); @@ -95,7 +100,7 @@ var BROWSER_SYNC_TO_PORT = parseInt( useIfDefined( process.env.BROWSER_SYNC_TO_P // Default // ------- gulp.task( 'default', [ 'jade', 'jade-php', 'sass', 'less', 'js', 'js-concat', 'copy' ] ); // Start // ----- @@ -141,7 +146,7 @@ gulp.task( 'js-concat', function () { // JS // -- gulp.task( 'js', function () { return gulp.src( [ './js/**/*.js', './js/main.js' ] ) .pipe( plumber() ) .pipe( gulpif( USE_JS_SOURCEMAPS, sourcemaps.init() ) ) .pipe( babel( { presets: [ 'es2015' ] } ) ) @@ -151,6 +156,18 @@ gulp.task( 'js', function () { .pipe( gulp.dest( DESTINATION + '/js' ) ); }); // Sass // ---- gulp.task( 'sass', function () { return gulp.src('./sass/*.scss') .pipe( plumber() ) .pipe( sass().on( 'error', sass.logError ) ) .pipe( autoprefixer( { browsers: [ 'last 3 versions' ] }) ) .pipe( csso() ) .pipe( gulp.dest( DESTINATION + '/css' ) ) .pipe( browserSync.stream( { match: '**/*.css' } ) ); }); // Less // ---- gulp.task( 'less', function () { @@ -162,7 +179,7 @@ gulp.task( 'less', function () { .pipe( csso() ) .pipe( gulpif( USE_CSS_SOURCEMAPS, sourcemaps.write( '.' ) ) ) .pipe( gulp.dest( DESTINATION + '/css' ) ) .pipe( browserSync.stream( { match: '**/*.css' } ) ); }); // Copy @@ -187,6 +204,8 @@ gulp.task('watch', function () { .on( 'change', browserSync.reload ); gulp.watch( 'jade/**/*.php.jade', [ 'jade-php' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'sass/**/*.sass', [ 'sass' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'less/**/*.less', [ 'less' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'js-concat/**/*', [ 'js-concat' ] ) -
rc1 revised this gist
Dec 16, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -154,7 +154,7 @@ gulp.task( 'js', function () { // Less // ---- gulp.task( 'less', function () { return gulp.src( 'less/*.less' ) .pipe( plumber() ) .pipe( gulpif( USE_CSS_SOURCEMAPS, sourcemaps.init())) .pipe( less() ) -
rc1 revised this gist
Sep 22, 2016 . 1 changed file with 34 additions and 24 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -32,30 +32,40 @@ var uglify = require( 'gulp-uglify' ); // Config // ====== /* Options only please. Use a caller script set specific configurations (hostname based, dev/production etc). Keep this generic so it can copy/pasted to other projects/contexts. ### Example Create an file called `gulp-config-local.env` containing: export DESTINATION="./.." \ USE_JADE_PRETTY=1 \ USE_JS_SOURCEMAPS=1 \ USE_JS_UGLYFY=1 \ USE_BROWSER_SYNC=1 \ BROWSER_SYNC_FROM_URL="rosscairns.local:80" \ BROWSER_SYNC_TO_PORT=8000 Then create a file called `script-gulp.sh` ##!/bin/bash if [ "$#" -lt 1 ]; then echo "[ Warning ] Did you forget a gulp argument like start?" fi . gulp-config-local.env gulp "$@" The set the file to be exectuable with `chmod u+x script-gulp.sh` Then run: `./script-gulp.sh start`. */ // Destination // ----------- -
rc1 revised this gist
Sep 22, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -45,7 +45,7 @@ var uglify = require( 'gulp-uglify' ); // USE_JS_SOURCEMAPS=1 \ // USE_JS_UGLYFY=1 \ // USE_BROWSER_SYNC=1 \ // BROWSER_SYNC_FROM_URL="rosscairns.dev:80" \ // BROWSER_SYNC_TO_PORT=8000 // // A file called `script-gulp.sh` -
rc1 revised this gist
Sep 21, 2016 . No changes.There are no files selected for viewing
-
rc1 revised this gist
Sep 21, 2016 . 1 changed file with 21 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -37,21 +37,21 @@ var uglify = require( 'gulp-uglify' ); // Keep this generic so it can copy/pasted to other projects/contexts. // // ### Example // // Create an file called `gulp-config-local.env` containing: // // export DESTINATION="./.." \ // USE_JADE_PRETTY=1 \ // USE_JS_SOURCEMAPS=1 \ // USE_JS_UGLYFY=1 \ // USE_BROWSER_SYNC=1 \ // BROWSER_SYNC_FROM_URL="rosscairns.local:80" \ // BROWSER_SYNC_TO_PORT=8000 // // A file called `script-gulp.sh` // // #!/bin/bash // // . gulp-config-local.env // gulp "$@" // @@ -77,8 +77,8 @@ var USE_CSS_SOURCEMAPS = !!process.env.USE_CSS_SOURCEMAPS; // BrowserSync // ----------- var USE_BROWSER_SYNC = !!process.env.USE_BROWSER_SYNC; var BROWSER_SYNC_FROM_URL = useIfDefined( process.env.BROWSER_SYNC_FROM_URL ).or( 'localhost:80' ); var BROWSER_SYNC_TO_PORT = parseInt( useIfDefined( process.env.BROWSER_SYNC_TO_PORT ).or( 8080 ), 10 ); // Tasks // ====== @@ -87,6 +87,11 @@ var BROWSER_SYNC_PROXY_ON_PORT = parseInt( useIfDefined( process.env.BROWSER_SYN // ------- gulp.task( 'default', [ 'jade', 'jade-php', 'less', 'js', 'js-concat', 'copy' ] ); // Start // ----- gulp.task( 'start', [ 'default', 'watch' ] ); // Jade // ---- gulp.task( 'jade', function () { @@ -139,7 +144,7 @@ gulp.task( 'js', function () { // Less // ---- gulp.task( 'less', function () { return gulp.src( 'less/all.less' ) .pipe( plumber() ) .pipe( gulpif( USE_CSS_SOURCEMAPS, sourcemaps.init())) .pipe( less() ) @@ -162,9 +167,9 @@ gulp.task( 'copy', function () { gulp.task('watch', function () { if ( USE_BROWSER_SYNC ) { browserSync.init({ port: BROWSER_SYNC_TO_PORT, proxy: BROWSER_SYNC_FROM_URL, ui: { port: BROWSER_SYNC_TO_PORT + 1 }, browser: [] }); } @@ -174,7 +179,11 @@ gulp.task('watch', function () { .on( 'change', browserSync.reload ); gulp.watch( 'less/**/*.less', [ 'less' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'js-concat/**/*', [ 'js-concat' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'js/**/*', [ 'js' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'copy/**/*', [ 'copy' ] ) .on( 'change', browserSync.reload ); }); -
rc1 revised this gist
Jul 15, 2016 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // Modules // ======= // // gulp gulp-plumber gulp-concat gulp-if gulp-rename gulp-sourcemaps browser-sync gulp-csso gulp-less gulp-autoprefixer gulp-uglify gulp-babel babel-preset-es2015 gulp-jade git://github.com/oroce/gulp-jade-php#v2.0.0-0 // Gulp // ---- @@ -168,7 +168,9 @@ gulp.task('watch', function () { browser: [] }); } gulp.watch( [ 'jade/**/*.jade', '!jade./**/*.php.jade' ], [ 'jade' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'jade/**/*.php.jade', [ 'jade-php' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'less/**/*.less', [ 'less' ] ) .on( 'change', browserSync.reload ); -
rc1 revised this gist
Jul 15, 2016 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -100,7 +100,12 @@ gulp.task( 'jade', function () { // -------- gulp.task( 'jade-php', function () { return gulp.src( [ 'jade/**/*.php.jade', '!jade/includes/**/*.php.jade' ] ) .pipe( plumber( { errorHandler: function ( err ) { console.error( 'jade-php error' ); console.error( err ); } })) .pipe( rename( function ( path ) { path.basename = path.basename.replace( '.php', '' ); })) -
rc1 revised this gist
Jul 15, 2016 . 1 changed file with 5 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -91,6 +91,7 @@ gulp.task( 'default', [ 'jade', 'jade-php', 'less', 'js', 'js-concat', 'copy' ] // ---- gulp.task( 'jade', function () { return gulp.src( [ 'jade/**/*.jade', '!jade/**/*.php.jade', '!jade/includes/**/*.jade' ] ) .pipe( plumber() ) .pipe( jade( { pretty: USE_JADE_PRETTY } ) ) .pipe( gulp.dest( DESTINATION ) ); }); @@ -99,6 +100,7 @@ gulp.task( 'jade', function () { // -------- gulp.task( 'jade-php', function () { return gulp.src( [ 'jade/**/*.php.jade', '!jade/includes/**/*.php.jade' ] ) .pipe( plumber() ) .pipe( rename( function ( path ) { path.basename = path.basename.replace( '.php', '' ); })) @@ -110,8 +112,7 @@ gulp.task( 'jade-php', function () { // ---------- // These are JS file which only need concatinating into libs.js (i.e. mininfied libaries) gulp.task( 'js-concat', function () { return gulp.src( [ 'js-concat/**/*.js' ] ) .pipe( plumber() ) .pipe( concat( 'concat.js' ) ) .pipe( gulp.dest( DESTINATION + '/js' ) ); @@ -120,8 +121,7 @@ gulp.task( 'js-concat', function () { // JS // -- gulp.task( 'js', function () { return gulp.src( [ '.js/**/*.js', './js/main.js' ] ) .pipe( plumber() ) .pipe( gulpif( USE_JS_SOURCEMAPS, sourcemaps.init() ) ) .pipe( babel( { presets: [ 'es2015' ] } ) ) @@ -134,8 +134,7 @@ gulp.task( 'js', function () { // Less // ---- gulp.task( 'less', function () { return gulp.src( 'assets/less/all.less' ) .pipe( plumber() ) .pipe( gulpif( USE_CSS_SOURCEMAPS, sourcemaps.init())) .pipe( less() ) @@ -156,7 +155,6 @@ gulp.task( 'copy', function () { // Watch // ----- gulp.task('watch', function () { if ( USE_BROWSER_SYNC ) { browserSync.init({ port: BROWSER_SYNC_PROXY_ON_PORT, @@ -165,7 +163,6 @@ gulp.task('watch', function () { browser: [] }); } gulp.watch( 'jade/**/*.jade', [ 'jade' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'less/**/*.less', [ 'less' ] ) -
rc1 revised this gist
Jul 15, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -102,7 +102,7 @@ gulp.task( 'jade-php', function () { .pipe( rename( function ( path ) { path.basename = path.basename.replace( '.php', '' ); })) .pipe( jadePhp( { pretty: USE_JADE_PRETTY, usestrip: true } ) ) .pipe( gulp.dest( DESTINATION ) ); }); -
rc1 revised this gist
Jul 15, 2016 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // Modules // ======= // // gulp gulp-plumber gulp-concat gulp-if gulp-rename gulp-sourcemaps browser-sync gulp-csso gulp-less gulp-autoprefixer gulp-uglify gulp-babel babel-preset-es2015 gulp-jade gulp-jade-php // Gulp // ---- @@ -10,6 +10,7 @@ var gulpif = require( 'gulp-if' ); var concat = require( 'gulp-concat' ); var plumber = require( 'gulp-plumber' ); var sourcemaps = require( 'gulp-sourcemaps' ); var rename = require( 'gulp-rename' ); // Watch // ----- var browserSync = require( 'browser-sync' ).create(); @@ -89,15 +90,18 @@ gulp.task( 'default', [ 'jade', 'jade-php', 'less', 'js', 'js-concat', 'copy' ] // Jade // ---- gulp.task( 'jade', function () { return gulp.src( [ 'jade/**/*.jade', '!jade/**/*.php.jade', '!jade/includes/**/*.jade' ] ) .pipe( jade( { pretty: USE_JADE_PRETTY } ) ) .pipe( gulp.dest( DESTINATION ) ); }); // Jade PHP // -------- gulp.task( 'jade-php', function () { return gulp.src( [ 'jade/**/*.php.jade', '!jade/includes/**/*.php.jade' ] ) .pipe( rename( function ( path ) { path.basename = path.basename.replace( '.php', '' ); })) .pipe( jadePhp( { pretty: USE_JADE_PRETTY } ) ) .pipe( gulp.dest( DESTINATION ) ); }); -
rc1 revised this gist
Jul 15, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -155,8 +155,8 @@ gulp.task('watch', function () { if ( USE_BROWSER_SYNC ) { browserSync.init({ port: BROWSER_SYNC_PROXY_ON_PORT, proxy: 'localhost:' + BROWSER_SYNC_PORT, ui: { port: BROWSER_SYNC_PROXY_ON_PORT + 1 }, browser: [] }); -
rc1 revised this gist
Jul 15, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -76,8 +76,8 @@ var USE_CSS_SOURCEMAPS = !!process.env.USE_CSS_SOURCEMAPS; // BrowserSync // ----------- var USE_BROWSER_SYNC = !!process.env.USE_BROWSER_SYNC; var BROWSER_SYNC_PORT = parseInt( useIfDefined( process.env.BROWSER_SYNC_PORT ).or( 8080 ), 10 ); var BROWSER_SYNC_PROXY_ON_PORT = parseInt( useIfDefined( process.env.BROWSER_SYNC_PROXY_ON_PORT ).or( 8081 ), 10 ); // Tasks // ====== -
rc1 revised this gist
Jul 15, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -77,7 +77,7 @@ var USE_CSS_SOURCEMAPS = !!process.env.USE_CSS_SOURCEMAPS; // ----------- var USE_BROWSER_SYNC = !!process.env.USE_BROWSER_SYNC; var BROWSER_SYNC_PORT = useIfDefined( process.env.BROWSER_SYNC_PORT ).or( 8080 ); var BROWSER_SYNC_PROXY_ON_PORT = useIfDefined( process.env.BROWSER_SYNC_PROXY_ON_PORT ).or( 8081 ); // Tasks // ====== -
rc1 revised this gist
Jul 15, 2016 . 1 changed file with 18 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,30 +1,33 @@ // Modules // ======= // // gulp gulp-plumber gulp-concat gulp-if gulp-sourcemaps browser-sync gulp-csso gulp-less gulp-autoprefixer gulp-uglify gulp-babel babel-preset-es2015 gulp-jade gulp-jade-php // Gulp // ---- var gulp = require( 'gulp' ); var gulpif = require( 'gulp-if' ); var concat = require( 'gulp-concat' ); var plumber = require( 'gulp-plumber' ); var sourcemaps = require( 'gulp-sourcemaps' ); // Watch // ----- var browserSync = require( 'browser-sync' ).create(); // Less // ---- var csso = require( 'gulp-csso' ); var less = require( 'gulp-less' ); var autoprefixer = require( 'gulp-autoprefixer' ); // Jade // ---- var jade = require( 'gulp-jade' ); // JadePHP // ------- var jadePhp = require( 'gulp-jade-php' ); // JS // -- var babel = require( 'gulp-babel' ); var uglify = require( 'gulp-uglify' ); // Config // ====== @@ -48,7 +51,7 @@ var jadePhp = require( 'gulp-jade-php' ); // // #!/bin/bash // // . gulp-config-local.env // gulp "$@" // // The run: `./script-gulp.sh jade` for example @@ -86,25 +89,25 @@ gulp.task( 'default', [ 'jade', 'jade-php', 'less', 'js', 'js-concat', 'copy' ] // Jade // ---- gulp.task( 'jade', function () { return gulp.src( [ 'jade/**/*.jade', '!jade/**/*.php.jade' ] ) .pipe( jade( { pretty: USE_JADE_PRETTY } ) ) .pipe( gulp.dest( DESTINATION ) ); }); // Jade PHP // -------- gulp.task( 'jade-php', function () { return gulp.src( './jade/**/*.php.jade' ) .pipe( jadePhp( { pretty: USE_JADE_PRETTY } ) ) .pipe( gulp.dest( DESTINATION ) ); }); // JS Contact // ---------- // These are JS file which only need concatinating into libs.js (i.e. mininfied libaries) gulp.task( 'js-concat', function () { return gulp .src( [ 'js-concat/**/*.js' ] ) .pipe( plumber() ) .pipe( concat( 'concat.js' ) ) .pipe( gulp.dest( DESTINATION + '/js' ) ); @@ -114,10 +117,10 @@ gulp.task( 'js-concat', function () { // -- gulp.task( 'js', function () { return gulp .src( [ '.js/**/*.js', './js/main.js' ] ) .pipe( plumber() ) .pipe( gulpif( USE_JS_SOURCEMAPS, sourcemaps.init() ) ) .pipe( babel( { presets: [ 'es2015' ] } ) ) .pipe( concat( 'all.js' ) ) .pipe( gulpif( USE_JS_UGLYFY, uglify() ) ) .pipe( gulpif( USE_JS_SOURCEMAPS, sourcemaps.write( '.' ) ) ) -
rc1 renamed this gist
Jul 15, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
rc1 renamed this gist
Jul 15, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
rc1 renamed this gist
Jul 15, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
rc1 created this gist
Jul 15, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,179 @@ // Modules // ======= // gulp gulp-plumber gulp-sourcemaps browser-sync gulp-csso gulp-less gulp-autoprefixer gulp-jade-php jade // Gulp // ---- var gulp = require( 'gulp' ); var plumber = require( 'gulp-plumber' ); var sourcemaps = require( 'gulp-sourcemaps' ); // Watch // ----- var browserSync = require( 'browser-sync' ).create(); // Less // ---- var csso = require( 'gulp-csso' ); var less = require( 'gulp-less' ); var autoprefixer = require( 'gulp-autoprefixer' ); // Jade // ---- var jade = require( 'jade' ); // JadePHP // ------- var jadePhp = require( 'gulp-jade-php' ); // Config // ====== // Options only please. // Use a caller script set specific configurations (hostname based, dev/production etc). // Keep this generic so it can copy/pasted to other projects/contexts. // // ### Example // // Create an file called `gulp-config-local.env` containing: // // export DESTINATION="./.." \ // USE_JADE_PRETTY=1 \ // USE_JS_SOURCEMAPS=1 \ // USE_JS_UGLYFY=1 \ // USE_BROWSER_SYNC=1 \ // BROWSER_SYNC_PORT=8080 \ // BROWSER_SYNC_PROXY_ON_PORT=8081 // // A file called `script-gulp.sh` // // #!/bin/bash // // . gulp-local.env // gulp "$@" // // The run: `./script-gulp.sh jade` for example // Destination // ----------- var DESTINATION = useIfDefined( process.env.DESTINATION ).or( './..' ); // Jade // ---- var USE_JADE_PRETTY = !!process.env.USE_JADE_PRETTY; // JS // -- var USE_JS_SOURCEMAPS = !!process.env.USE_JS_SOURCEMAPS; var USE_JS_UGLYFY = !!process.env.USE_JS_UGLYFY; // CSS // --- var USE_CSS_SOURCEMAPS = !!process.env.USE_CSS_SOURCEMAPS; // BrowserSync // ----------- var USE_BROWSER_SYNC = !!process.env.USE_BROWSER_SYNC; var BROWSER_SYNC_PORT = useIfDefined( process.env.BROWSER_SYNC_PORT ).or( 8080 ); var BROWSER_SYNC_PROXY_ON_PORT = useIfDefined( process.env.WATCH_BROWSER_SYNC_PORT ).or( 8081 ); // Tasks // ====== // Default // ------- gulp.task( 'default', [ 'jade', 'jade-php', 'less', 'js', 'js-concat', 'copy' ] ); // Jade // ---- gulp.task( 'jade', function () { return gulp.src( './jade/**/*.jade', '!./jade/**/*.php.jade' ) .pipe( jade( { pretty: USE_JADE_PRETTY } ) ) .pipe( gulp.dest( './build' ) ); }); // Jade PHP // -------- gulp.task( 'jade-php', function () { return gulp.src( './jade/**/*.jade', '!./jade/**/*.php.jade' ) .pipe( jade( { pretty: USE_JADE_PRETTY } ) ) .pipe( gulp.dest( './build' ) ); }); // JS Contact // ---------- // These are JS file which only need concatinating into libs.js (i.e. mininfied libaries) gulp.task( 'js-concat', function () { return gulp .src( [ './js-concat/**/*.js' ] ) .pipe( plumber() ) .pipe( concat( 'concat.js' ) ) .pipe( gulp.dest( DESTINATION + '/js' ) ); }); // JS // -- gulp.task( 'js', function () { return gulp .src( [ './js/**/*.js', './js/main.js' ] ) .pipe( plumber() ) .pipe( gulpif( USE_JS_SOURCEMAPS, sourcemaps.init() ) ) .pipe(babel( { presets: [ 'es2015' ] } ) ) .pipe( concat( 'all.js' ) ) .pipe( gulpif( USE_JS_UGLYFY, uglify() ) ) .pipe( gulpif( USE_JS_SOURCEMAPS, sourcemaps.write( '.' ) ) ) .pipe( gulp.dest( DESTINATION + '/js' ) ); }); // Less // ---- gulp.task( 'less', function () { gulp .src( 'assets/less/all.less' ) .pipe( plumber() ) .pipe( gulpif( USE_CSS_SOURCEMAPS, sourcemaps.init())) .pipe( less() ) .pipe( autoprefixer( { browsers: [ 'last 3 versions' ] }) ) .pipe( csso() ) .pipe( gulpif( USE_CSS_SOURCEMAPS, sourcemaps.write( '.' ) ) ) .pipe( gulp.dest( DESTINATION + '/css' ) ) .pipe( browserSync.stream( {match: '**/*.css'} ) ); }); // Copy // ---- gulp.task( 'copy', function () { return gulp.src( [ './copy/**' ] ) .pipe( gulp.dest( DESTINATION ) ); }); // Watch // ----- gulp.task('watch', function () { if ( USE_BROWSER_SYNC ) { browserSync.init({ port: BROWSER_SYNC_PORT, proxy: 'localhost:' + BROWSER_SYNC_PROXY_ON_PORT, ui: { port: BROWSER_SYNC_PROXY_ON_PORT + 1 }, browser: [] }); } gulp.watch( 'jade/**/*.jade', [ 'jade' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'less/**/*.less', [ 'less' ] ) .on( 'change', browserSync.reload ); gulp.watch( 'less/**/*', [ 'copy' ] ) .on( 'change', browserSync.reload ); }); // Utils // ===== function useIfDefined( arg ) { return { or: function ( alternative ) { return arg ? arg : alternative; } }; }