Add webpack as gulp task
This commit is contained in:
35
gulpfile.js
35
gulpfile.js
@@ -1,16 +1,17 @@
|
|||||||
var gulp = require('gulp'),
|
var gulp = require('gulp');
|
||||||
browserSync = require('browser-sync').create(),
|
var browserSync = require('browser-sync').create();
|
||||||
args = require('yargs').argv,
|
var args = require('yargs').argv;
|
||||||
gulpif = require('gulp-if'),
|
var gulpif = require('gulp-if');
|
||||||
sass = require('gulp-sass'),
|
var sass = require('gulp-sass');
|
||||||
sourcemaps = require('gulp-sourcemaps');
|
var sourcemaps = require('gulp-sourcemaps');
|
||||||
|
var webpackStream = require('webpack-stream');
|
||||||
|
|
||||||
var paths = {
|
var paths = {
|
||||||
sassAll: 'sass/**/*.scss',
|
sassAll: 'sass/**/*.scss',
|
||||||
cssDest: 'css'
|
cssDest: 'css'
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('serve', function() {
|
gulp.task('serve', function () {
|
||||||
browserSync.init({
|
browserSync.init({
|
||||||
server: {
|
server: {
|
||||||
baseDir: "./"
|
baseDir: "./"
|
||||||
@@ -20,16 +21,22 @@ gulp.task('serve', function() {
|
|||||||
gulp.watch(['*.html', '*.css', '*.js']).on('change', browserSync.reload);
|
gulp.watch(['*.html', '*.css', '*.js']).on('change', browserSync.reload);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('sass', function() {
|
gulp.task('sass', function () {
|
||||||
return gulp.src(paths.sassAll)
|
return gulp.src(paths.sassAll)
|
||||||
.pipe(gulpif(args.debug, sourcemaps.init()))
|
.pipe(gulpif(args.debug, sourcemaps.init()))
|
||||||
.pipe(sass().on('error', sass.logError))
|
.pipe(sass().on('error', sass.logError))
|
||||||
.pipe(gulpif(args.debug, sourcemaps.write()))
|
.pipe(gulpif(args.debug, sourcemaps.write()))
|
||||||
.pipe(gulp.dest(paths.cssDest));
|
.pipe(gulp.dest(paths.cssDest));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('watch', function() {
|
gulp.task('watch', function () {
|
||||||
gulp.watch(paths.sassAll, ['sass']);
|
gulp.watch(paths.sassAll, ['sass']);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['sass']);
|
gulp.task('webpack', function () {
|
||||||
|
return gulp.src('./src/boot.ts')
|
||||||
|
.pipe(webpackStream(require('./webpack.config.js')))
|
||||||
|
.pipe(gulp.dest('build/'));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('default', ['sass', 'webpack']);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"typings": "^0.8.1",
|
"typings": "^0.8.1",
|
||||||
"webpack": "^1.13.0",
|
"webpack": "^1.13.0",
|
||||||
"webpack-dev-server": "^1.14.1",
|
"webpack-dev-server": "^1.14.1",
|
||||||
|
"webpack-stream": "^3.2.0",
|
||||||
"webpack-svgstore-plugin": "^2.1.5",
|
"webpack-svgstore-plugin": "^2.1.5",
|
||||||
"yargs": "^4.2.0"
|
"yargs": "^4.2.0"
|
||||||
},
|
},
|
||||||
@@ -46,7 +47,7 @@
|
|||||||
"postinstall": "typings install",
|
"postinstall": "typings install",
|
||||||
"lint": "tslint 'src/**/*.ts' 'config-serializer/**/*.ts'",
|
"lint": "tslint 'src/**/*.ts' 'config-serializer/**/*.ts'",
|
||||||
"typings": "typings",
|
"typings": "typings",
|
||||||
"build": "webpack",
|
"build": "gulp",
|
||||||
"build:test": "webpack --config 'config-serializer/webpack.config.js'",
|
"build:test": "webpack --config 'config-serializer/webpack.config.js'",
|
||||||
"webpack": "webpack",
|
"webpack": "webpack",
|
||||||
"webpack-dev-server": "webpack-dev-server"
|
"webpack-dev-server": "webpack-dev-server"
|
||||||
|
|||||||
Reference in New Issue
Block a user