Skip to content

node.js plugins + gulp #2589

Answered by brendan8c
brendan8c asked this question in Help
Jun 13, 2021 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Write JS code for each plugin.
Here is an example of how I adapted the 'html-minifier' plugin for gulp

const { src, dest, series } = require('gulp');
const htmlMinify = require('html-minifier');

const options = {
    includeAutoGeneratedTags: true,
    removeAttributeQuotes: true,
    removeComments: true,
    removeRedundantAttributes: true,
    removeScriptTypeAttributes: true,
    removeStyleLinkTypeAttributes: true,
    sortClassName: true,
    useShortDoctype: true,
    collapseWhitespace: true
};

function test12() {
    return src('app/**/*.html')
        .on('data', function(file) {
            const buferFile = Buffer.from(htmlMinify.minify(file.contents.toString(), options))

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by brendan8c
Comment options

You must be logged in to vote
1 reply
@brendan8c
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants