2016-01-29 01:27:15 +03:00
|
|
|
/*
|
2016-02-04 17:03:20 +03:00
|
|
|
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
|
2016-01-29 01:27:15 +03:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2016-09-30 14:29:45 +03:00
|
|
|
"use strict"
|
|
|
|
|
2016-01-29 01:27:15 +03:00
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Imports
|
|
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
2016-09-30 14:29:45 +03:00
|
|
|
var gulp = require("gulp")
|
|
|
|
var args = require("yargs").argv
|
|
|
|
var autoprefix = require("autoprefixer")
|
|
|
|
var changed = require("gulp-changed")
|
|
|
|
var child = require("child_process")
|
|
|
|
var clean = require("del")
|
|
|
|
var compact = require("gulp-remove-empty-lines")
|
|
|
|
var concat = require("gulp-concat")
|
|
|
|
var gulpif = require("gulp-if")
|
|
|
|
var mincss = require("gulp-cssnano")
|
|
|
|
var minhtml = require("gulp-htmlmin")
|
|
|
|
var minsvg = require("gulp-svgmin")
|
|
|
|
var modernizr = require("gulp-modernizr")
|
|
|
|
var mqpacker = require("css-mqpacker")
|
|
|
|
var notifier = require("node-notifier")
|
|
|
|
var path = require("path")
|
|
|
|
var plumber = require("gulp-plumber")
|
|
|
|
var postcss = require("gulp-postcss")
|
|
|
|
var replace = require("gulp-replace")
|
|
|
|
var rev = require("gulp-rev")
|
|
|
|
var sass = require("gulp-sass")
|
|
|
|
var sasslint = require("gulp-sass-lint")
|
|
|
|
var sourcemaps = require("gulp-sourcemaps")
|
|
|
|
var stream = require("webpack-stream")
|
|
|
|
var uglify = require("gulp-uglify")
|
|
|
|
var util = require("gulp-util")
|
|
|
|
var vinyl = require("vinyl-paths")
|
|
|
|
var version = require("gulp-rev-replace")
|
|
|
|
var webpack = require("webpack")
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Locals
|
|
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
2016-02-11 14:09:58 +03:00
|
|
|
/* MkDocs server */
|
2016-09-30 14:29:45 +03:00
|
|
|
var server = null
|
2016-01-29 01:27:15 +03:00
|
|
|
|
2016-09-11 20:00:53 +03:00
|
|
|
/* Watching context */
|
2016-09-30 14:29:45 +03:00
|
|
|
var watch = false
|
2016-09-11 20:00:53 +03:00
|
|
|
|
2016-01-29 01:27:15 +03:00
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Overrides
|
|
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Override gulp.src() for nicer error handling.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
var src = gulp.src // TODO: do this via extension somehow...
|
2016-01-29 01:27:15 +03:00
|
|
|
gulp.src = function() {
|
|
|
|
return src.apply(gulp, arguments)
|
|
|
|
.pipe(
|
|
|
|
plumber(function(error) {
|
|
|
|
util.log(util.colors.red(
|
2016-09-30 14:29:45 +03:00
|
|
|
"Error (" + error.plugin + "): " + error.message
|
|
|
|
))
|
2016-09-08 20:43:23 +03:00
|
|
|
|
|
|
|
/* Extract file where error happened, if existent */
|
|
|
|
var file = error.relativePath
|
2016-09-30 14:29:45 +03:00
|
|
|
? error.relativePath.split("/").pop()
|
|
|
|
: ""
|
2016-09-08 20:43:23 +03:00
|
|
|
|
|
|
|
/* Dispatch system-level notification */
|
2016-01-29 01:27:15 +03:00
|
|
|
notifier.notify({
|
2016-09-30 14:29:45 +03:00
|
|
|
title: "Error (" + error.plugin + "): " + file,
|
2016-08-07 19:01:56 +03:00
|
|
|
message: error.messageOriginal
|
2016-09-30 14:29:45 +03:00
|
|
|
})
|
|
|
|
this.emit("end")
|
|
|
|
}))
|
|
|
|
}
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Asset pipeline
|
|
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
2016-09-08 20:43:23 +03:00
|
|
|
/*
|
2016-09-11 20:00:53 +03:00
|
|
|
* Clean stylesheets generated by build.
|
2016-09-08 20:43:23 +03:00
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:clean:stylesheets", () => {
|
|
|
|
return gulp.src("material/assets/stylesheets/*")
|
|
|
|
.pipe(vinyl(clean))
|
|
|
|
})
|
2016-09-11 20:00:53 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Clean javascripts generated by build.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:clean:javascripts", () => {
|
|
|
|
return gulp.src("material/assets/javascripts/*")
|
|
|
|
.pipe(vinyl(clean))
|
|
|
|
})
|
2016-09-08 20:43:23 +03:00
|
|
|
|
2016-09-11 20:00:53 +03:00
|
|
|
/*
|
|
|
|
* Clean images generated by build.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:clean:images", () => {
|
|
|
|
return gulp.src("material/assets/images/*")
|
|
|
|
.pipe(vinyl(clean))
|
|
|
|
})
|
2016-09-11 20:00:53 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Clean files generated by build.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:clean", [
|
|
|
|
"assets:clean:stylesheets",
|
|
|
|
"assets:clean:javascripts",
|
|
|
|
"assets:clean:images"
|
|
|
|
])
|
2016-09-11 20:00:53 +03:00
|
|
|
|
2016-01-29 01:27:15 +03:00
|
|
|
/*
|
|
|
|
* Build stylesheets from SASS source.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:build:stylesheets", args.production ? [
|
|
|
|
"assets:clean:stylesheets",
|
|
|
|
"assets:build:images"
|
|
|
|
] : [], () => {
|
|
|
|
return gulp.src("src/assets/stylesheets/*.scss")
|
2016-01-29 01:27:15 +03:00
|
|
|
.pipe(gulpif(args.sourcemaps, sourcemaps.init()))
|
|
|
|
.pipe(
|
|
|
|
sass({
|
|
|
|
includePaths: [
|
2016-09-30 14:29:45 +03:00
|
|
|
"node_modules/modularscale-sass/stylesheets",
|
|
|
|
"node_modules/material-design-color",
|
|
|
|
"node_modules/material-shadows"
|
2016-01-29 01:27:15 +03:00
|
|
|
]
|
|
|
|
}))
|
|
|
|
.pipe(
|
|
|
|
postcss([
|
|
|
|
autoprefix(),
|
|
|
|
mqpacker
|
|
|
|
]))
|
|
|
|
.pipe(gulpif(args.sourcemaps, sourcemaps.write()))
|
|
|
|
.pipe(gulpif(args.production, mincss()))
|
2016-09-11 20:00:53 +03:00
|
|
|
.pipe(gulpif(args.production, rev()))
|
|
|
|
.pipe(gulpif(args.production,
|
2016-09-30 14:29:45 +03:00
|
|
|
version({ manifest: gulp.src("manifest.json") })))
|
|
|
|
.pipe(gulp.dest("material/assets/stylesheets"))
|
2016-09-11 20:00:53 +03:00
|
|
|
.pipe(gulpif(args.production,
|
2016-09-30 14:29:45 +03:00
|
|
|
rev.manifest("manifest.json", {
|
|
|
|
base: "material/assets",
|
2016-09-11 20:00:53 +03:00
|
|
|
merge: true
|
|
|
|
})))
|
2016-09-30 14:29:45 +03:00
|
|
|
.pipe(gulpif(args.production, gulp.dest("material/assets")))
|
|
|
|
})
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/*
|
2016-08-07 19:01:56 +03:00
|
|
|
* Build javascripts by transpiling ES6 with babel.
|
2016-01-29 01:27:15 +03:00
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:build:javascripts", args.production ? [
|
|
|
|
"assets:clean:javascripts"
|
|
|
|
] : [], () => {
|
|
|
|
return gulp.src("src/assets/javascripts/**/*.js")
|
2016-08-07 19:01:56 +03:00
|
|
|
.pipe(
|
|
|
|
stream({
|
2016-09-30 14:29:45 +03:00
|
|
|
entry: "application.js",
|
2016-08-07 19:01:56 +03:00
|
|
|
output: {
|
2016-09-30 14:29:45 +03:00
|
|
|
filename: "application.js"
|
2016-08-07 19:01:56 +03:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [{
|
2016-09-30 14:29:45 +03:00
|
|
|
loader: "babel-loader",
|
|
|
|
test: path.join(__dirname, "src/assets/javascripts"),
|
2016-08-07 19:01:56 +03:00
|
|
|
query: {
|
2016-09-30 14:29:45 +03:00
|
|
|
presets: "es2015"
|
2016-08-07 19:01:56 +03:00
|
|
|
}
|
2016-09-30 14:29:45 +03:00
|
|
|
}, {
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: "eslint-loader",
|
|
|
|
exclude: /node_modules/
|
2016-08-07 19:01:56 +03:00
|
|
|
}]
|
|
|
|
},
|
|
|
|
plugins: [
|
2016-09-30 14:29:45 +03:00
|
|
|
new webpack.NoErrorsPlugin()
|
2016-08-07 19:01:56 +03:00
|
|
|
].concat(
|
|
|
|
args.production ? [
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
compress: {
|
|
|
|
warnings: false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
] : []),
|
|
|
|
stats: {
|
|
|
|
colors: true
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
modulesDirectories: [
|
2016-09-30 14:29:45 +03:00
|
|
|
"src/assets/javascripts",
|
|
|
|
"node_modules"
|
2016-08-07 19:01:56 +03:00
|
|
|
],
|
|
|
|
extensions: [
|
2016-09-30 14:29:45 +03:00
|
|
|
"", ".js"
|
2016-08-07 19:01:56 +03:00
|
|
|
]
|
|
|
|
},
|
2016-09-30 14:29:45 +03:00
|
|
|
devtool: args.sourcemaps ? "source-map" : ""
|
2016-08-07 19:01:56 +03:00
|
|
|
}))
|
2016-09-11 20:00:53 +03:00
|
|
|
.pipe(gulpif(args.production, rev()))
|
2016-09-30 14:29:45 +03:00
|
|
|
.pipe(gulp.dest("material/assets/javascripts"))
|
2016-09-11 20:00:53 +03:00
|
|
|
.pipe(gulpif(args.production,
|
2016-09-30 14:29:45 +03:00
|
|
|
rev.manifest("manifest.json", {
|
|
|
|
base: "material/assets",
|
2016-09-11 20:00:53 +03:00
|
|
|
merge: true
|
|
|
|
})))
|
2016-09-30 14:29:45 +03:00
|
|
|
.pipe(gulpif(args.production, gulp.dest("material/assets")))
|
|
|
|
})
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a customized modernizr build.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:build:modernizr", [
|
|
|
|
"assets:build:stylesheets",
|
|
|
|
"assets:build:javascripts"
|
|
|
|
], () => {
|
2016-01-29 01:27:15 +03:00
|
|
|
return gulp.src([
|
2016-09-30 14:29:45 +03:00
|
|
|
"material/assets/stylesheets/*.css",
|
|
|
|
"material/assets/javascripts/*.js"
|
2016-01-29 01:27:15 +03:00
|
|
|
]).pipe(
|
|
|
|
modernizr({
|
|
|
|
options: [
|
2016-09-30 14:29:45 +03:00
|
|
|
"addTest", /* Add custom tests */
|
|
|
|
"fnBind", /* Use function.bind */
|
|
|
|
"html5printshiv", /* HTML5 support for IE */
|
|
|
|
"setClasses", /* Add CSS classes to root tag */
|
|
|
|
"testProp" /* Test for properties */
|
2016-01-29 01:27:15 +03:00
|
|
|
]
|
|
|
|
}))
|
2016-09-30 14:29:45 +03:00
|
|
|
.pipe(concat("modernizr.js"))
|
2016-01-29 01:27:15 +03:00
|
|
|
.pipe(gulpif(args.production, uglify()))
|
2016-09-11 20:00:53 +03:00
|
|
|
.pipe(gulpif(args.production, rev()))
|
2016-09-30 14:29:45 +03:00
|
|
|
.pipe(gulp.dest("material/assets/javascripts"))
|
2016-09-11 20:00:53 +03:00
|
|
|
.pipe(gulpif(args.production,
|
2016-09-30 14:29:45 +03:00
|
|
|
rev.manifest("manifest.json", {
|
|
|
|
base: "material/assets",
|
2016-09-11 20:00:53 +03:00
|
|
|
merge: true
|
|
|
|
})))
|
2016-09-30 14:29:45 +03:00
|
|
|
.pipe(gulpif(args.production, gulp.dest("material/assets")))
|
|
|
|
})
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/*
|
2016-09-11 20:00:53 +03:00
|
|
|
* Copy and minify vector graphics.
|
2016-01-29 01:27:15 +03:00
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:build:images:svg", () => {
|
|
|
|
return gulp.src("src/assets/images/**/*.svg")
|
|
|
|
.pipe(gulpif(watch, changed("material/assets/images")))
|
2016-09-11 20:00:53 +03:00
|
|
|
.pipe(gulpif(args.production, minsvg()))
|
|
|
|
.pipe(gulpif(args.production, rev()))
|
2016-09-30 14:29:45 +03:00
|
|
|
.pipe(gulp.dest("material/assets/images"))
|
2016-01-29 01:27:15 +03:00
|
|
|
.pipe(gulpif(args.production,
|
2016-09-30 14:29:45 +03:00
|
|
|
rev.manifest("manifest.json", {
|
|
|
|
base: "material/assets",
|
2016-09-11 20:00:53 +03:00
|
|
|
merge: true
|
2016-01-29 01:27:15 +03:00
|
|
|
})))
|
2016-09-30 14:29:45 +03:00
|
|
|
.pipe(gulpif(args.production, gulp.dest("material/assets")))
|
|
|
|
})
|
2016-09-11 20:00:53 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy favicon.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:build:images:ico", () => {
|
|
|
|
return gulp.src("src/assets/images/**/*.ico")
|
|
|
|
.pipe(gulp.dest("material/assets/images"))
|
|
|
|
})
|
2016-09-11 20:00:53 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy images.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:build:images", [
|
|
|
|
"assets:clean:images"
|
|
|
|
], () => {
|
2016-09-11 20:00:53 +03:00
|
|
|
return gulp.start([
|
2016-09-30 14:29:45 +03:00
|
|
|
"assets:build:images:svg",
|
|
|
|
"assets:build:images:ico"
|
|
|
|
])
|
|
|
|
})
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Minify views.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:build:views", args.production ? [
|
|
|
|
"assets:build:stylesheets",
|
|
|
|
"assets:build:modernizr",
|
|
|
|
"assets:build:images"
|
|
|
|
] : [], () => {
|
|
|
|
var metadata = require("./package.json")
|
|
|
|
return gulp.src("src/**/*.html")
|
|
|
|
.pipe(gulpif(watch, changed("material")))
|
2016-09-11 20:00:53 +03:00
|
|
|
.pipe(
|
2016-01-29 01:27:15 +03:00
|
|
|
minhtml({
|
|
|
|
collapseBooleanAttributes: true,
|
|
|
|
removeComments: true,
|
|
|
|
removeScriptTypeAttributes: true,
|
2016-09-08 20:43:23 +03:00
|
|
|
removeStyleLinkTypeAttributes: true,
|
|
|
|
customAttrCollapse: /(content)/
|
2016-01-29 01:27:15 +03:00
|
|
|
}))
|
2016-09-30 14:29:45 +03:00
|
|
|
.pipe(replace("$theme-name$", metadata.name))
|
|
|
|
.pipe(replace("$theme-version$", metadata.version))
|
2016-01-29 01:27:15 +03:00
|
|
|
.pipe(compact())
|
|
|
|
.pipe(gulpif(args.production,
|
2016-09-30 14:29:45 +03:00
|
|
|
version({ manifest: gulp.src("manifest.json") })))
|
|
|
|
.pipe(gulp.dest("material"))
|
|
|
|
})
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Build assets.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:build", [
|
|
|
|
"assets:build:stylesheets",
|
|
|
|
"assets:build:javascripts",
|
|
|
|
"assets:build:modernizr",
|
|
|
|
"assets:build:images",
|
|
|
|
"assets:build:views"
|
|
|
|
])
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Watch assets for changes and rebuild on the fly.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("assets:watch", () => {
|
|
|
|
watch = true
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/* Rebuild stylesheets */
|
|
|
|
gulp.watch([
|
2016-09-30 14:29:45 +03:00
|
|
|
"src/assets/stylesheets/**/*.scss"
|
|
|
|
], ["assets:build:stylesheets"])
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/* Rebuild javascripts */
|
|
|
|
gulp.watch([
|
2016-09-30 14:29:45 +03:00
|
|
|
"src/assets/javascripts/**/*.js"
|
|
|
|
], ["assets:build:javascripts"])
|
2016-01-29 01:27:15 +03:00
|
|
|
|
2016-09-11 20:00:53 +03:00
|
|
|
/* Copy images */
|
2016-01-29 01:27:15 +03:00
|
|
|
gulp.watch([
|
2016-09-30 14:29:45 +03:00
|
|
|
"src/assets/images/**/*"
|
|
|
|
], ["assets:build:images"])
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/* Minify views */
|
|
|
|
gulp.watch([
|
2016-09-30 14:29:45 +03:00
|
|
|
"src/**/*.html"
|
|
|
|
], ["assets:build:views"])
|
|
|
|
})
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Application server
|
|
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/*
|
2016-02-11 14:09:58 +03:00
|
|
|
* Build documentation.
|
2016-01-29 01:27:15 +03:00
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("mkdocs:build", [
|
|
|
|
"assets:build"
|
|
|
|
], () => {
|
|
|
|
return child.spawnSync("mkdocs", ["build"])
|
|
|
|
})
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/*
|
2016-02-11 14:09:58 +03:00
|
|
|
* Restart MkDocs server.
|
2016-01-29 01:27:15 +03:00
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("mkdocs:serve", () => {
|
2016-01-29 01:27:15 +03:00
|
|
|
if (server)
|
2016-09-30 14:29:45 +03:00
|
|
|
server.kill()
|
2016-01-29 01:27:15 +03:00
|
|
|
|
2016-02-11 14:09:58 +03:00
|
|
|
/* Spawn MkDocs server */
|
2016-09-30 14:29:45 +03:00
|
|
|
server = child.spawn("mkdocs", ["serve", "-a", "0.0.0.0:8000"])
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/* Pretty print server log output */
|
2016-09-30 14:29:45 +03:00
|
|
|
server.stdout.on("data", data => {
|
|
|
|
var lines = data.toString().split("\n")
|
2016-01-29 01:27:15 +03:00
|
|
|
for (var l in lines)
|
|
|
|
if (lines[l].length)
|
2016-09-30 14:29:45 +03:00
|
|
|
util.log(lines[l])
|
|
|
|
})
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/* Print errors to stdout */
|
2016-09-30 14:29:45 +03:00
|
|
|
server.stderr.on("data", data => {
|
|
|
|
process.stdout.write(data.toString())
|
|
|
|
})
|
|
|
|
})
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Interface
|
|
|
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/*
|
2016-02-11 14:09:58 +03:00
|
|
|
* Build assets and documentation.
|
2016-01-29 01:27:15 +03:00
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("build", [
|
|
|
|
"assets:clean",
|
|
|
|
"assets:build"
|
2016-02-11 14:09:58 +03:00
|
|
|
].concat(args.mkdocs
|
2016-09-30 14:29:45 +03:00
|
|
|
? "mkdocs:build"
|
|
|
|
: []))
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/*
|
2016-02-11 14:09:58 +03:00
|
|
|
* Start asset and MkDocs watchdogs.
|
2016-01-29 01:27:15 +03:00
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("watch", [
|
|
|
|
"assets:clean",
|
|
|
|
"assets:build"
|
|
|
|
], () => {
|
2016-01-29 01:27:15 +03:00
|
|
|
return gulp.start([
|
2016-09-30 14:29:45 +03:00
|
|
|
"assets:watch"
|
2016-02-11 14:09:58 +03:00
|
|
|
].concat(args.mkdocs
|
2016-09-30 14:29:45 +03:00
|
|
|
? "mkdocs:serve"
|
|
|
|
: []))
|
|
|
|
})
|
2016-01-29 01:27:15 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Build assets by default.
|
|
|
|
*/
|
2016-09-30 14:29:45 +03:00
|
|
|
gulp.task("default", ["build"])
|