Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thingsym/hugo-theme-techdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthingsym <thingsym@gmail.com>2019-10-06 09:34:21 +0300
committerthingsym <thingsym@gmail.com>2019-10-06 09:34:21 +0300
commitb7270a4be595d3a655c0feb7c71e4d87b50db4ad (patch)
treed26a836bdf49c70b573088b3ba9ac8fe8af72e7e /gulpfile.js
parent4d55f8b8441460977f92f1a4c2b05a4130d40868 (diff)
chore: improve development environment
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js41
1 files changed, 19 insertions, 22 deletions
diff --git a/gulpfile.js b/gulpfile.js
index eb294fd..3dfa4fa 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -5,6 +5,10 @@ var $ = require('gulp-load-plugins')();
require('es6-promise').polyfill();
+var webpack = require("webpack");
+var webpackStream = require("webpack-stream");
+var webpackConfig = require("./webpack.config");
+
var runSequence = require('run-sequence');
var browserSync = require('browser-sync').create();
@@ -12,10 +16,7 @@ var reload = browserSync.reload;
var src_paths = {
sass: ['src/scss/*.scss'],
- script: [
- 'static/js/*.js',
- '!static/js/*.min.js'
- ],
+ script: ['src/js/*.js'],
};
var dest_paths = {
@@ -76,33 +77,29 @@ gulp.task('sass:style', function() {
.pipe(gulp.dest(dest_paths.style));
});
-gulp.task('javascript', function() {
- return gulp.src(src_paths.script)
- .pipe($.uglify().on( 'error', $.util.log ))
- .pipe($.rename({ suffix: '.min' }))
- .pipe(gulp.dest(dest_paths.script));
-});
-
gulp.task('lint:javascript', function() {
- return gulp.src(src_paths.script)
+ return gulp.src(dest_paths.script)
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'));
});
-gulp.task('browser-sync', function() {
- browserSync.init({
- server: {
- baseDir: dest_paths.browserSync
- }
- });
+gulp.task('lint:eslint', function() {
+ return gulp.src(src_paths.script)
+ .pipe($.eslint.format())
+ .pipe($.eslint.failAfterError());
+});
- gulp.watch(src_paths.sass, ['default']).on('change', reload);
+gulp.task('webpack', function() {
+ return webpackStream(webpackConfig, webpack)
+ .on('error', function (e) {
+ this.emit('end');
+ })
+ .pipe(gulp.dest("dist"));
});
-gulp.task('lint', ['lint:sass', 'lint:javascript']);
+gulp.task('lint', ['lint:sass', 'lint:eslint', 'lint:javascript']);
gulp.task('sass', ['sass:style']);
-gulp.task('script', ['javascript']);
-gulp.task('serve', ['browser-sync']);
+gulp.task('script', ['webpack']);
gulp.task('default', function(callback) {
runSequence(