ZIJ / gulp-webpack-build

Helps to generate bundles based on webpack config

Home Page:http://mdreizin.github.io/gulp-webpack-build

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NPM version Dependency Status Dependency Status

NPM

gulp-webpack-build

Helps to build bundles based on webpack configs

Usage

'use strict';

var path = require('path'),
    gulp = require('gulp'),
    webpack = require('gulp-webpack-build');

var src = './src/**',
    dest = './dist',
    webpackOptions = {
        debug: true,
        devtool: '#source-map'
    };

gulp.task('webpack', [], function() {
    return gulp.src(src)
        .pipe(webpack.compile(webpackOptions))
        .pipe(webpack.format({
            version: false,
            timings: true
        }))
        .pipe(webpack.failAfter({
            errors: true,
            warnings: true
        }))
        .pipe(gulp.dest(dest));
});

gulp.task('watch', function() {
    gulp.watch(src).on('change', function(event) {
        if (event.type === 'changed') {
            webpack.watch(event.path, webpackOptions, { base: path.resolve(event.path) }, function(err, stats) {
                gulp.src(event.path)
                    .pipe(webpack.proxy(err, stats))
                    .pipe(webpack.format({
                        verbose: true,
                        version: false
                    }))
                    .pipe(gulp.dest(dest));
            });
        }
    });
});

About

Helps to generate bundles based on webpack config

http://mdreizin.github.io/gulp-webpack-build

License:MIT License


Languages

Language:JavaScript 100.0%