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>2018-03-04 12:19:45 +0300
committerthingsym <thingsym@gmail.com>2018-03-04 12:19:45 +0300
commit393b8389ddae8e8b5ba7578924e028431fe106a7 (patch)
treef971e70f1d46b49ca7a044c28a178f9ce3bb01ce /gulpfile.js
initial commit
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js95
1 files changed, 95 insertions, 0 deletions
diff --git a/gulpfile.js b/gulpfile.js
new file mode 100644
index 0000000..965c124
--- /dev/null
+++ b/gulpfile.js
@@ -0,0 +1,95 @@
+'use strict';
+
+var gulp = require('gulp');
+var $ = require('gulp-load-plugins')();
+
+var scsslint = require('gulp-scss-lint');
+require('es6-promise').polyfill();
+
+var runSequence = require('run-sequence');
+
+var browserSync = require('browser-sync').create();
+var reload = browserSync.reload;
+
+var src_paths = {
+ sass: ['src/scss/*.scss'],
+ script: [
+ 'static/js/*.js',
+ '!static/js/*.min.js'
+ ],
+};
+
+var dest_paths = {
+ style: 'static/css/',
+ script: 'static/js/',
+ browserSync: ''
+};
+
+
+gulp.task('lint:sass', function() {
+ return gulp.src(src_paths.sass)
+ .pipe(scsslint({
+ 'config': 'scss-lint.yml'
+ }));
+});
+
+gulp.task('sass:style', function() {
+ return gulp.src(src_paths.sass)
+ .pipe($.plumber({
+ errorHandler: function(err) {
+ console.log(err.messageFormatted);
+ this.emit('end');
+ }
+ }))
+ .pipe($.sass( { outputStyle: 'expanded' } ).on( 'error', $.sass.logError ) )
+ .pipe($.autoprefixer({
+ browsers: ['last 2 versions'],
+ cascade: false
+ }))
+ .pipe(gulp.dest(dest_paths.style))
+ .pipe(browserSync.stream())
+ .pipe($.cssnano())
+ .pipe($.rename({ suffix: '.min' }))
+ .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)
+ .pipe($.jshint())
+ .pipe($.jshint.reporter('jshint-stylish'));
+});
+
+gulp.task('browser-sync', function() {
+ browserSync.init({
+ server: {
+ baseDir: dest_paths.browserSync
+ }
+ });
+
+ gulp.watch(src_paths.sass, ['default']).on('change', reload);
+});
+
+gulp.task('lint', ['lint:sass', 'lint:javascript']);
+gulp.task('sass', ['sass:style']);
+gulp.task('script', ['javascript']);
+gulp.task('serve', ['browser-sync']);
+
+gulp.task('default', function(callback) {
+ runSequence(
+ 'lint',
+ 'sass',
+ 'script',
+ callback
+ );
+});
+
+gulp.task('watch', function() {
+ gulp.watch(src_paths.sass, ['default']);
+});