diff --git a/gulpfile.js b/gulpfile.js index 4e7f59a8..bcfcd8a7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,12 +1,17 @@ var gulp = require('gulp'); var plugins = require('gulp-load-plugins')(); var del = require('del'); +var replace = require('gulp-replace'); +var bootstrapIconsVersion = require('./node_modules/bootstrap-icons/package.json').version; gulp.task('clean', () => del(['dist/*', 'lib/*'])); -gulp.task('html', () => gulp.src('./src/index.html').pipe(plugins.htmlmin({ - collapseWhitespace: true, - minifyCSS: true, - minifyJS: true -})).pipe(gulp.dest('dist'))); +gulp.task('html', () => gulp.src('./src/index.html') + .pipe(replace('https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.min.css', 'https://cdn.jsdelivr.net/npm/bootstrap-icons@' + bootstrapIconsVersion +'/font/bootstrap-icons.min.css')) + .pipe(plugins.htmlmin({ + collapseWhitespace: true, + minifyCSS: true, + minifyJS: true + })) + .pipe(gulp.dest('dist'))); gulp.task('assets', () => gulp.src('./src/assets/**/*.*', { encoding: false }).pipe(gulp.dest('dist/assets'))); gulp.task('flatpickr', () => gulp.src('./node_modules/flatpickr/dist/**/*', { encoding: false }).pipe(gulp.dest('dist/lib/flatpickr'))); gulp.task('formiojs', () => gulp.src('./node_modules/@formio/js/dist/**/*', { encoding: false }).pipe(gulp.dest('dist/lib/formiojs'))); @@ -26,3 +31,8 @@ gulp.task('build', gulp.parallel( 'bootswatch', 'moment-timezone' )); +gulp.task('inlinesource', function () { + return gulp.src('./dist/*.html') + .pipe(plugins.inlineSource()) + .pipe(gulp.dest('./dist')); +}); diff --git a/package.json b/package.json index 28125770..8285adbe 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "A Form.io form viewer application", "main": "index.js", "scripts": { - "build": "gulp clean && tsc --project tsconfig.json && gulp build && webpack --config webpack.config.js", + "build": "gulp clean && tsc --project tsconfig.json && gulp build && webpack --config webpack.config.js && gulp inlinesource", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { @@ -41,6 +41,7 @@ "gulp-load-plugins": "^2.0.8", "gulp-minify-css": "^1.2.3", "gulp-rename": "^2.0.0", + "gulp-replace": "^1.1.4", "gulp-s3": "^0.11.0", "gulp-streamify": "^1.0.2", "gulp-uglify": "^3.0.2", diff --git a/src/index.html b/src/index.html index ec0c9765..2b748b32 100644 --- a/src/index.html +++ b/src/index.html @@ -4,15 +4,15 @@ - - - - + + + + - - - + + +