/hexo-generator-optimize

Hexo plugin that optimizes (concat/min/gzip/img-min) and optionally deploys your site

Primary LanguageJavaScript

Hexo Plugin to Optimize Website Files for Deployment

Generator for Hexo that optimizes CSS, JS, HTML, and imgages + optionally deploys your site.

Your CSS and JS gets saved and inserted into your HTML as main.min.css and main.min.js with a cache-busting query string appended. We skip any CDN links.

Notice

concatenate seems doesn't work well , if you deploy with nginx I'm trying to review the code and fix the bugs.

Command Line Usage

To generate, then optimize, and optionally deploy (-d flag)...

hexo optimize -d
# or aliases...
hexo o #hexo optimize
hexo od #hexo optimize -d

Config Options

In Hexo's _config.yml you can set the following options...

optimize:
  # Defaults
  image_min: true
    optimizationLevel: 4
  css_concat: true
  css_min: true
  js_concat: true
  js_min: true
  html_min: true
    removeComments: true
    removeCommentsFromCDATA: true
    collapseWhitespace: true
    collapseBooleanAttributes: true
    removeEmptyAttributes: true
  gzip: true

If you want to deploy be sure to set up one of the deployment options in your config as well.

deploy:
  type: rsync
  host: <host>
  user: <user>
  root: <root>
  port: [port] # Default is 22
  delete: [true|false] # Default is true