Skip to content

Commit

Permalink
fix(html-minify): ignore interpolation expressions
Browse files Browse the repository at this point in the history
also introduces better error handling for the processMarkup task

closes #619
  • Loading branch information
JeroenVinke committed May 23, 2017
1 parent 9bfe9bc commit 803c904
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/resources/tasks/process-markup-minify-max.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import gulp from 'gulp';
import htmlmin from 'gulp-htmlmin';
import plumber from 'gulp-plumber';
import notify from 'gulp-notify';
import changedInPlace from 'gulp-changed-in-place';
import project from '../aurelia.json';
import {build} from 'aurelia-cli';

export default function processMarkup() {
return gulp.src(project.markupProcessor.source)
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(changedInPlace({firstPass:true}))
.pipe(htmlmin({
removeComments: true,
Expand All @@ -16,7 +19,8 @@ export default function processMarkup() {
minifyCSS: true,
minifyJS: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
removeStyleLinkTypeAttributes: true,
ignoreCustomFragments: [/\${.*}/g] // ignore interpolation expressions
}))
.pipe(build.bundle());
}
6 changes: 5 additions & 1 deletion lib/resources/tasks/process-markup-minify-max.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import * as gulp from 'gulp';
import * as htmlmin from 'gulp-htmlmin';
import * as plumber from 'gulp-plumber';
import * as notify from 'gulp-notify';
import * as changedInPlace from 'gulp-changed-in-place';
import * as project from '../aurelia.json';
import {build} from 'aurelia-cli';

export default function processMarkup() {
return gulp.src(project.markupProcessor.source)
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(changedInPlace({firstPass:true}))
.pipe(htmlmin({
removeComments: true,
Expand All @@ -16,7 +19,8 @@ export default function processMarkup() {
minifyCSS: true,
minifyJS: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
removeStyleLinkTypeAttributes: true,
ignoreCustomFragments: [/\${.*}/g] // ignore interpolation expressions
}))
.pipe(build.bundle());
}
6 changes: 5 additions & 1 deletion lib/resources/tasks/process-markup-minify-min.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import gulp from 'gulp';
import htmlmin from 'gulp-htmlmin';
import plumber from 'gulp-plumber';
import notify from 'gulp-notify';
import changedInPlace from 'gulp-changed-in-place';
import project from '../aurelia.json';
import {build} from 'aurelia-cli';

export default function processMarkup() {
return gulp.src(project.markupProcessor.source)
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(changedInPlace({firstPass:true}))
.pipe(htmlmin({
removeComments: true,
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true
minifyJS: true,
ignoreCustomFragments: [/\${.*}/g] // ignore interpolation expressions
}))
.pipe(build.bundle());
}
6 changes: 5 additions & 1 deletion lib/resources/tasks/process-markup-minify-min.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import * as gulp from 'gulp';
import * as htmlmin from 'gulp-htmlmin';
import * as plumber from 'gulp-plumber';
import * as notify from 'gulp-notify';
import * as changedInPlace from 'gulp-changed-in-place';
import * as project from '../aurelia.json';
import {build} from 'aurelia-cli';

export default function processMarkup() {
return gulp.src(project.markupProcessor.source)
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(changedInPlace({firstPass:true}))
.pipe(htmlmin({
removeComments: true,
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true
minifyJS: true,
ignoreCustomFragments: [/\${.*}/g] // ignore interpolation expressions
}))
.pipe(build.bundle());
}

0 comments on commit 803c904

Please sign in to comment.