Giter Site home page Giter Site logo

ashutoshsce / minify-html-webpack-plugin Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 4.0 12 KB

A webpack plugin to minify html file(s) after building

License: MIT License

JavaScript 100.00%
minify html-minifier html webpack4 webpack3 webpack-plugin file mix laravel-mix-plugin php

minify-html-webpack-plugin's People

Contributors

ashutoshsce avatar colinwirt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

minify-html-webpack-plugin's Issues

Search and Replace

Is it possible to search and replace a string in all .HTML files? For example, I have a string "CACHE_KEY" that I want to find every instance of in all HTML files and have it replaced with a hash. It seems to search and replace will find the first instance, then stop. I was hoping it can search the entire dist direct and replace all.

Call plugin at the end of build

Is there a way to call this plugin at the end of build?
I'm using laravel-mix with laravel-mix-nunjucks plugin to compile nunjucks files into html, so the files don't exist yet. Maybe it's not even this plugin-related question.

The script fails if the `src` directory contains any directory

If the source directory contains a folder inside apart from the expected html files, the script results in an error since it is expecting to read a file.

Potential Fixes:

  1. Check before reading whether a file is a directory or not.
  2. Create enhancement to recursively go through all the subdirectories and look up for HTML files.

Script minifies the original source code. No warning!

After running the script, I found that it performs minification on the original source HTML file itself by default. Usually this behaviour is not expected and can cause damage in case the source file is not protected using a version control.

Potential Fixes (in the descending order of preference):

  1. Read the webpack's output>path directory and pass it to the script.
  2. Throw an error when dest is not provided in the options.
  3. Make it explicit in the README that dest is needed and provide a warning that original source code will be overwritten if dest is missing from the options.

`path` is not defined

When running the wepack command to perform a build, it throws an error:

ReferenceError: path is not defined
    at C:\Users\Rishab Manocha\Source code\agency-website\node_modules\minify-html-webpack-plugin\index.js:24:28

Looking in the index.js file, it looks like the you forgot to add

const path = require('path');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.