ClickHouse/website/gulpfile.js
Ivan Blinkov c7e526e050
WIP on documentation (#2692)
* Additional .gitignore entries

* Merge a bunch of small articles about system tables into single one

* Merge a bunch of small articles about formats into single one

* Adapt table with formats to English docs too

* Add SPb meetup link to main page

* Move Utilities out of top level of docs (the location is probably not yet final) + translate couple articles

* Merge MacOS.md into build_osx.md

* Move Data types higher in ToC

* Publish changelog on website alongside documentation

* Few fixes for en/table_engines/file.md

* Use smaller header sizes in changelogs

* Group up table engines inside ToC

* Move table engines out of top level too

* Specificy in ToC that query language is SQL based. Thats a bit excessive, but catches eye.

* Move stuff that is part of query language into respective folder

* Move table functions lower in ToC

* Lost redirects.txt update

* Do not rely on comments in yaml + fix few ru titles

* Extract major parts of queries.md into separate articles

* queries.md has been supposed to be removed

* Fix weird translation

* Fix a bunch of links

* There is only table of contents left

* "Query language" is actually part of SQL abbreviation

* Change filename in README.md too

* fix mistype

* s/formats\/interfaces/interfaces\/formats/g

* Remove extra clarification from header as it was too verbose, probably making it a bit more confusing

* Empty article was supposed to be hidden

* At least change incorrect title

* Move special links to the bottom of nav and slightly highlight them

* Skip hidden pages in bottom navigation too

* Make front page of documentation to be part of Introduction

* Make tables in introduction somewhat readable + move abbreviation definitions earlier

* Some introduction text refactoring

* Some docs introduction refactoring

* Use admonitions instead of divs

* Additional .gitignore

* Treat .gif as images too

* Clarify ToC item
2018-07-20 20:35:34 +03:00

149 lines
4.1 KiB
JavaScript

var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var cleanCss = require('gulp-clean-css');
var imagemin = require('gulp-imagemin');
var sourcemaps = require('gulp-sourcemaps');
var htmlmin = require('gulp-htmlmin');
var minifyInline = require('gulp-minify-inline');
var del = require('del');
var connect = require('gulp-connect');
var run = require('gulp-run');
var outputDir = 'public';
var docsDir = '../docs';
var paths = {
htmls: [
'**/*.html',
'!deprecated/reference_ru.html',
'!deprecated/reference_en.html',
'!node_modules/**/*.html',
'!presentations/**/*.html',
'!public/**/*.html'],
reference: ['deprecated/reference_ru.html', 'deprecated/reference_en.html'],
docs: [docsDir + '/build/**/*'],
docstxt: ['docs/**/*.txt', 'docs/redirects.conf'],
docsjson: ['docs/**/*.json'],
docsxml: ['docs/**/*.xml'],
docssitemap: ['sitemap.xml'],
scripts: [
'**/*.js',
'!gulpfile.js',
'!node_modules/**/*.js',
'!presentations/**/*.js',
'!public/**/*.js'],
styles: [
'**/*.css',
'!node_modules/**/*.css',
'!presentations/**/*.css',
'!public/**/*.css'],
images: [
'**/*.{jpg,jpeg,png,gif,svg,ico}',
'!node_modules/**/*.{jpg,jpeg,png,gif,svg,ico}',
'!presentations/**/*.{jpg,jpeg,png,gif,svg,ico}',
'!public/**/*.{jpg,jpeg,png,gif,svg,ico}'],
robotstxt: ['robots.txt'],
presentations: ['presentations/**/*']
};
gulp.task('clean', function () {
return del([outputDir + '/**']);
});
gulp.task('reference', [], function () {
return gulp.src(paths.reference)
.pipe(minifyInline())
.pipe(gulp.dest(outputDir + '/deprecated'))
});
gulp.task('docs', [], function () {
run('cd ' + docsDir + '/tools; ./build.py');
return gulp.src(paths.docs)
.pipe(gulp.dest(outputDir + '/../docs'))
});
gulp.task('docstxt', ['docs'], function () {
return gulp.src(paths.docstxt)
.pipe(gulp.dest(outputDir + '/docs'))
});
gulp.task('docsjson', ['docs'], function () {
return gulp.src(paths.docsjson)
.pipe(gulp.dest(outputDir + '/docs'))
});
gulp.task('docsxml', ['docs'], function () {
return gulp.src(paths.docsxml)
.pipe(gulp.dest(outputDir + '/docs'))
});
gulp.task('docssitemap', [], function () {
return gulp.src(paths.docssitemap)
.pipe(gulp.dest(outputDir + '/docs'))
});
gulp.task('presentations', [], function () {
return gulp.src(paths.presentations)
.pipe(gulp.dest(outputDir + '/presentations'))
});
gulp.task('robotstxt', [], function () {
return gulp.src(paths.robotstxt)
.pipe(gulp.dest(outputDir))
});
gulp.task('htmls', ['docs', 'docstxt', 'docsjson', 'docsxml', 'docssitemap'], function () {
return gulp.src(paths.htmls)
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(minifyInline())
.pipe(gulp.dest(outputDir))
});
gulp.task('sourcemaps', ['docs'], function () {
return gulp.src(paths.scripts)
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest(outputDir))
});
gulp.task('scripts', ['docs'], function () {
return gulp.src(paths.scripts)
.pipe(uglify())
.pipe(gulp.dest(outputDir))
});
gulp.task('styles', ['docs'], function () {
return gulp.src(paths.styles)
.pipe(cleanCss())
.pipe(gulp.dest(outputDir))
});
gulp.task('images', ['docs'], function () {
return gulp.src(paths.images)
.pipe(imagemin({optimizationLevel: 9}))
.pipe(gulp.dest(outputDir))
});
gulp.task('watch', function () {
gulp.watch(paths.htmls, ['htmls']);
gulp.watch(paths.docs, ['docs']);
gulp.watch(paths.reference, ['reference']);
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.images, ['images']);
});
gulp.task('connect', function() {
connect.server({
root: outputDir,
port: 8080,
keepalive: true,
livereload: true
})
});
gulp.task('build', ['htmls', 'robotstxt', 'reference', 'scripts', 'styles', 'images', 'presentations']);
gulp.task('default', ['build', 'connect']);