mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-25 10:03:45 +03:00
Build minified version
This commit is contained in:
parent
dbfc9fe4a0
commit
d7fac00ae4
|
@ -3,7 +3,7 @@ module.exports = {
|
|||
html: 'lib/**/*.html',
|
||||
scss: 'lib/**/*.scss',
|
||||
sourceEntryPoint: 'lib/index.js',
|
||||
outputName: 'redoc.full.js',
|
||||
outputName: 'redoc.full',
|
||||
output: 'dist/',
|
||||
tmp: '.tmp/',
|
||||
demo: 'demo/**/*',
|
||||
|
|
|
@ -10,8 +10,10 @@ var concat = require('gulp-concat');
|
|||
var gulp = require('gulp');
|
||||
var sass = require('gulp-sass');
|
||||
var replace = require('gulp-replace');
|
||||
var uglify = require('gulp-uglify');
|
||||
var rename = require('gulp-rename');
|
||||
|
||||
paths.redocBuilt = path.join(paths.output, paths.outputName);
|
||||
paths.redocBuilt = path.join(paths.output, paths.outputName) + '.js';
|
||||
gulp.task('build', function (callback) {
|
||||
return runSequence(
|
||||
'clean',
|
||||
|
@ -20,7 +22,7 @@ gulp.task('build', function (callback) {
|
|||
);
|
||||
});
|
||||
|
||||
gulp.task('bundle', ['bundleSfx', 'concatDeps']);
|
||||
gulp.task('bundle', ['bundleSfx', 'concatDeps', 'uglify']);
|
||||
|
||||
gulp.task('inlineTemplates', ['sass'], function() {
|
||||
return gulp.src(paths.source, { base: './' })
|
||||
|
@ -29,6 +31,16 @@ gulp.task('inlineTemplates', ['sass'], function() {
|
|||
.pipe(gulp.dest(paths.tmp));
|
||||
});
|
||||
|
||||
// produces minimized verstion of sfx bundle
|
||||
gulp.task('uglify', ['concatDeps'], function() {
|
||||
return gulp.src(paths.redocBuilt)
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(uglify())
|
||||
.pipe(rename(paths.outputName + '.min.js'))
|
||||
.pipe(sourcemaps.write('./'))
|
||||
.pipe(gulp.dest(paths.output));
|
||||
});
|
||||
|
||||
var JS_DEV_DEPS = [
|
||||
'node_modules/zone.js/dist/zone-microtask.js',
|
||||
'node_modules/reflect-metadata/Reflect.js'
|
||||
|
@ -44,7 +56,7 @@ gulp.task('sass', function () {
|
|||
gulp.task('concatDeps', ['bundleSfx'], function() {
|
||||
gulp.src(JS_DEV_DEPS.concat([paths.redocBuilt]))
|
||||
.pipe(sourcemaps.init({loadMaps: true}))
|
||||
.pipe(concat(paths.outputName))
|
||||
.pipe(concat(paths.outputName + '.js'))
|
||||
.pipe(sourcemaps.write('.'))
|
||||
.pipe(gulp.dest(paths.output))
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user