M
M
Mark Ivanych2015-07-06 14:52:43
gulp.js
Mark Ivanych, 2015-07-06 14:52:43

How to make gulp-html-minifier friends with non-standard tags?

Good afternoon, I use the Freemarker template engine, the syntax is this: gulp-html-minifier: https://www.npmjs.com/package/gulp-html-minifier Accordingly, when called:
<#if 0 gt class.postId>ОК.</#if>

var gulp = require('gulp'),
        minifyHTML = require('gulp-html-minifier'),
        concat = require('gulp-concat');

gulp.task('minify-html', function () {
    return gulp.src('./templates/html/*')
            .pipe(minifyHTML({collapseWhitespace: true}))
            .pipe(gulp.dest('./templates/html_build/'));
});

Error output:
/usr/lib/node_modules/gulp-html-minifier/node_modules/event-stream/node_modules/map-stream/index.js:103
        throw err
              ^
Error: Parse Error: <#if 0 gt class.postId>

The task is essentially simple "Purge HTML from line breaks and spaces". Maybe there is a simpler alternative?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Zachinalov, 2015-07-06
@SanDiesel

Nothing is clear. html-minifer works with html, freemarker must be in *.ftl files. Judging by the error, you give .ftl to minify immediately, without distilling it into html.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question