Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement html minifier #1015

Merged
merged 5 commits into from
Sep 10, 2020
Merged

feat: implement html minifier #1015

merged 5 commits into from
Sep 10, 2020

Conversation

stefanfrede
Copy link
Contributor

Changes

Minify HTML output of @snowpack/plugin-webpack.

Testing

Tested locally.

@stefanfrede stefanfrede requested a review from a team as a code owner September 8, 2020 15:21
@vercel vercel bot temporarily deployed to Preview September 8, 2020 15:21 Inactive
@vercel
Copy link

vercel bot commented Sep 8, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pikapkg/snowpack/fmbdjqo81
✅ Preview: Canceled

[update for 9ab1562 canceled]

@drwpow
Copy link
Collaborator

drwpow commented Sep 8, 2020

Awesome! I love this.

Happy to merge this, but would you mind adding an option to the webpack plugin to configure this behavior? That way someone can not only customize it, but also disable it if it gives them errors

plugins: [
  [
    "@snowpack/plugin-webpack",
    {
      htmlMinifierOptions: false // disabled entirely
    }
  ]
]
plugins: [
  [
    "@snowpack/plugin-webpack",
    {
      htmlMinifierOptions: {
        // custom options:
        collapseWhitespace: true,
        removeComments: true,
        removeEmptyAttributes: true,
        removeRedundantAttributes: true,
        removeScriptTypeAttributes: true,
        removeStyleLinkTypeAttributes: true,
      }
    }
  ]
]

Also be sure to add:

  • default options (the ones you have already are fine)
  • documentation to this plugin’s README.md

Edit: changed the example to allow for configuration as well as disabling

@vercel vercel bot temporarily deployed to Preview September 9, 2020 03:52 Inactive
plugins/plugin-webpack/README.md Outdated Show resolved Hide resolved
plugins/plugin-webpack/plugin.js Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview September 9, 2020 19:42 Inactive
@vercel vercel bot temporarily deployed to Preview September 9, 2020 21:13 Inactive
Copy link
Contributor

@gr2m gr2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks 👍🏼

@gr2m gr2m requested a review from drwpow September 9, 2020 23:26
@drwpow
Copy link
Collaborator

drwpow commented Sep 9, 2020

Awesome! Thanks so much for listening to feedback. This is looking good—just have one question before we merge on whether this is still able to be disabled.

@vercel vercel bot temporarily deployed to Preview September 10, 2020 02:03 Inactive
@gr2m gr2m merged commit fa4190d into FredKSchott:master Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants