Giter Club home page Giter Club logo

html-minifier-module's Introduction

⚠️ This module is experimental, try it and let us know how it performs

@nuxtjs/html-minifier

npm (scoped with tag) npm CircleCI

Minify the html for each request served by nuxt server (nuxt start)

ℹ️ nuxt generate already has built-in support for minifying html

🔥 Using this module could be a performance hit 🔥 it is recommended to only use it when you have a caching proxy in front of your Nuxt server (at least until we have benchmarks to determine the real world impact)

Usage

yarn add @nuxtjs/html-minifier OR npm i @nuxtjs/html-minifier

Add @nuxtjs/html-minifier to modules section of nuxt.config.js

{
  modules: [
    ['@nuxtjs/html-minifier', { log: 'once', logHtml: true }]
 ]
}

Options

keepTrying

  • Default: true

If false then every url which generated an error wont be minified in future requests

log

  • Default: always

  • always: always log html-minifier errors

  • once: only log html-minifier errors once for each url

  • false: never log html-minifier errors

logHtml

  • Default: false

Be wary to enable this in production, your disk could fill up quickly!

If true then the html which failed to minimize is also logged

HTML Minifier options

This module uses the build.html.minify property for configuring html minifier

Development

  • Clone this repository
  • Install dependencies using yarn install or npm install
  • Start development server using npm run dev

License

MIT License

Copyright (c) Nuxt Community.

html-minifier-module's People

Contributors

atinux avatar clarkdo avatar pimlie avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

farnabaz

html-minifier-module's Issues

NPM Package not Found

I try to install this module but an error arose saying that this npm package is not found.

Configuration does not seem to have any effect when running under `yarn dev`

Hello,

New to Nuxt so just throwing everything at it, but I cannot make this work when running yarn dev.

If I run yarn generate I get minified HTML.

The issue is, I am using the following config and need the whitespace between the nodes removed:

// nuxt.config.js

const minify = {
  collapseWhitespace: true,
  collapseInlineTagWhitespace: true,
  collapseBooleanAttributes: true,
  decodeEntities: true,
  minifyCSS: true,
  minifyJS: true,
  processConditionalComments: true,
  removeEmptyAttributes: true,
  removeRedundantAttributes: true,
  trimCustomFragments: true,
  useShortDoctype: true
}

export default {
  // ...

  generate: {
    html: {
      minify
    }
  },

  build: {
    html: {
      minify
    }
  },
}

Have also tried adding the modules as mentioned in your docs (though the Nuxt docs do not mention this):

  modules: [
    // ...
    '@nuxtjs/html-minifier',
  ],

  buildModules: [
    // ...
    '@nuxtjs/html-minifier',
  ],

Collapsed whitespace seems to be the default Vue setup, so having just migrated a project to Nuxt, the layout is off.

Am I missing something really basic?

Been thrashing around for hours now :(

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update devdependency eslint-plugin-jest to v28
  • chore(deps): update devdependency eslint-plugin-standard to v5
  • chore(deps): update devdependency get-port to v7
  • chore(deps): update node.js to v17
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

circleci
.circleci/config.yml
  • circleci/node 10.16.0
npm
package.json
  • consola ^2.15.0
  • figures ^3.2.0
  • html-minifier ^4.0.0
  • @nuxtjs/eslint-config ^1.1.2
  • babel-eslint ^10.1.0
  • codecov 3.8.1
  • eslint ^6.8.0
  • eslint-config-standard ^13.0.1
  • eslint-loader ^2.2.1
  • eslint-plugin-import ^2.22.1
  • eslint-plugin-jest ^22.21.0
  • eslint-plugin-node ^9.2.0
  • eslint-plugin-promise ^4.2.1
  • eslint-plugin-standard ^4.1.0
  • eslint-plugin-vue ^5.2.3
  • get-port ^5.1.1
  • jest 24.9.0
  • nuxt-edge ^2.9.0-26104328.b22e0543
  • request-promise-native ^1.0.9
  • standard-version 7.1.0

  • Check this box to trigger a request for Renovate to run again on this repository

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.