Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var gulp = require('gulp');
- var del = require('del');
- var concat = require('gulp-concat');
- var gulpFilter = require('gulp-filter');
- var postcss = require('gulp-postcss');
- var autoprefixer = require('autoprefixer');
- var mqpacker = require('css-mqpacker');
- var csswring = require('csswring');
- var cssnano = require('cssnano');
- var stylus = require('gulp-stylus');
- var uglify = require('gulp-uglify');
- var jscs = require('gulp-jscs');
- var jshint = require('gulp-jshint');
- //var noop = function() {};
- var stylish = require('gulp-jscs-stylish');
- //var browserSync = require('browser-sync').create();
- var browserSync = require('browser-sync');
- var nodemon = require('gulp-nodemon');
- gulp.task('clean', function() {
- return del([
- 'public/**/*'
- ]);
- });
- gulp.task('css', function() {
- var processors = [
- autoprefixer({browsers: ['last 1 version']}),
- mqpacker,
- csswring,
- cssnano
- ];
- var filter = gulpFilter(['*', '!normalize.min.css', '!flexboxgrid.min.css'], {restore: true});
- return gulp.src([
- './bower_components/normalize-css/normalize.min.css',
- './bower_components/flexboxgrid/dist/flexboxgrid.min.css',
- './src/css/**/*.styl'
- ])
- .pipe(filter)
- .pipe(stylus())
- .pipe(postcss(processors))
- .pipe(filter.restore)
- .pipe(concat('styles.css'))
- //.pipe(gulp.dest('./public/css'));
- .pipe(gulp.dest('./public/css'))
- .pipe(browserSync.stream());
- });
- gulp.task('js', function() {
- var filter = gulpFilter(['*', '!masonry.pkgd.min.js'], {restore: true});
- return gulp.src([
- './bower_components/masonry/dist/masonry.pkgd.min.js',
- './src/js/**/*.js'
- ])
- .pipe(filter)
- .pipe(jshint())
- //.pipe(jscs())
- //.pipe(stylish.combineWithHintResults())
- .pipe(jshint.reporter('jshint-stylish'))
- .pipe(uglify())
- .pipe(filter.restore)
- .pipe(concat('scripts.js'))
- //.pipe(gulp.dest('./public/js'));
- .pipe(gulp.dest('./public/js'))
- .pipe(browserSync.stream());
- });
- gulp.task('img', function() {
- });
- gulp.task('serve', ['nodemon', 'css', 'js'], function() {
- browserSync.init({
- port: 5000,
- proxy: 'http://localhost:3000',
- browser: ['google-chrome']
- });
- gulp.watch('./src/css/**/*.styl', ['css']);
- gulp.watch('./src/js/**/*.js', ['js']);
- });
- gulp.task('nodemon', function(cb) {
- var called = false;
- return nodemon({
- watch: ['./app.js', './views**/*.jade']
- })
- .on('start', function onStart() {
- if (!called) {
- cb();
- }
- called = true;
- })
- .on('restart', function onRestart() {
- setTimeout(function reload() {
- browserSync.reload({
- stream: false
- }, 500);
- });
- })
- });
- gulp.task('default', ['serve']);
Advertisement
Add Comment
Please, Sign In to add comment