Gists for Structuring Your Gulp Workflow on Fixate's blog.
Last active
April 22, 2016 09:48
-
-
Save larrybotha/a4db8b9d1f8dbf4a196b85437a6c7e0b to your computer and use it in GitHub Desktop.
This file contains 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 characters
const gulp = require('gulp'); | |
const conf = require('../gulpconfig'); | |
gulp.task('browser-sync', function() { | |
return global.browserSync.init({ | |
server: { | |
baseDir: conf.path.src.base, | |
}, | |
injectchanges: true, | |
}); | |
}); |
This file contains 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 characters
const gulp = require('gulp'); | |
const autoprefixer = require('gulp-autoprefixer'); | |
const sass = require('gulp-sass'); | |
const conf = require('../gulpconfig'); | |
gulp.task('css', function() { | |
return gulp.src([conf.path.src.scss + '/**/*.{scss,sass}']) | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(autoprefixer({ | |
browsers: ['last 2 versions'] | |
})) | |
.pipe(gulp.dest(conf.path.dest.css)); | |
}); | |
gulp.task('css:watch', ['css'], function() { | |
return global.browserSync.reload('*.css'); | |
}); |
This file contains 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 characters
├── [project src / built files / other configs etc.] | |
├── ... | |
├── gulp | |
│ ├── tasks | |
│ │ ├── browserSync.js | |
│ │ ├── css.js | |
│ │ └── watch.js | |
│ └── gulpconfig.js | |
├── Gulpfile.js | |
├── ... | |
└── package.json |
This file contains 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 characters
var src = 'src'; | |
var dest = 'built'; | |
module.exports = { | |
path: { | |
src: { | |
base: src, | |
scss: src + '/scss', | |
}, | |
dest: { | |
base: dest, | |
css: dest + '/css', | |
}, | |
}, | |
}; |
This file contains 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 characters
const gulp = require('gulp'); | |
const requireDir = require('require-dir'); | |
const browserSync = require('browser-sync').create(); | |
global.browserSync = browserSync; | |
requireDir('./gulp/tasks', {recurse: false}); | |
gulp.task('default', ['watch']); |
This file contains 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 characters
const gulp = require('gulp'); | |
const watch = require('gulp-watch'); | |
const conf = require('../gulpconfig'); | |
gulp.task('watch', ['css', 'browser-sync'], function() { | |
gulp.watch(conf.path.src.scss + '/**/*.scss', ['css:watch']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment