digitalsparky / jekyll-minifier

Jekyll HTML/XML/CSS/JS Minifier utilising yui-compressor, and htmlcompressor
GNU General Public License v3.0
243 stars 23 forks source link

It's not working anymore #48

Open mathiasleroy opened 5 years ago

mathiasleroy commented 5 years ago

This plugin is not working anymore for me.

No errors, just not minifying

Here is my _config.yml

title: BoomBoom
permalink: pretty
markdown: kramdown

exclude: [
        'disclaimer.html'
    ]

sass:
    style: :compressed

plugins:
    - jekyll-minifier

jekyll-minifier:
  preserve_php: true                # Default: false
  remove_spaces_inside_tags: true   # Default: true
  remove_multi_spaces: true         # Default: true
  remove_comments: true             # Default: true
  remove_intertag_spaces: true      # Default: false
  remove_quotes: false              # Default: false
  compress_css: true                # Default: true
  compress_javascript: true         # Default: true
  simple_doctype: false             # Default: false
  remove_script_attributes: false   # Default: false
  remove_style_attributes: false    # Default: false
  remove_link_attributes: false     # Default: false
  remove_form_attributes: false     # Default: false
  remove_input_attributes: false    # Default: false
  remove_javascript_protocol: true # Default: false
  remove_http_protocol: false       # Default: false
  remove_https_protocol: false      # Default: false
  preserve_line_breaks: false       # Default: false
  simple_boolean_attributes: false  # Default: false
  compress_js_templates: true      # Default: false
gadgethm commented 5 years ago

This is likely because you need to set the Jekyll build environment to production. It defaults to development instead, and as a feature this gem only will run when the environment is set to production.

For my build process, this makes sense. I have a test build script which is for debugging, and doesn't need to spend the extra time minimizing while generating my website. But when I do my production build, I want all of my HTML and JQuery to be minimized. So my build script will set the production environment variable when making the final website, and the development environment all other times.

Hope that helps! See https://jekyllrb.com/docs/configuration/environments/ for details on build environments for Jekyll

ExSidius commented 5 years ago

@gadgethm I'm running into the same issue despite having JEKYLL_ENV set.

% echo $JEKYLL_ENV
production

My config file is as follows -

url: "http://enes100.umd.edu"
plugins:
  - jekyll-sitemap
  - jekyll-minifier

jekyll-minifier:
  uglifier_args:
    harmony: true

Any ideas?

gadgethm commented 5 years ago

Hmm... Try turning harmony off? On my setup I don't have that setting enabled.

I also use a rakefile to set the build environment, but the command that is sent is essentially the following: JEKYLL_ENV=production jekyll build

You are also welcome to try my settings and see if that works better for you:

plugins:
    - jekyll-minifier

sass:
   sass_dir: _sass
   style: compressed

jekyll-minifier:
    preserve_php: false
    remove_spaces_inside_tags: true
    remove_multi_spaces: true
    remove_comments: true
    remove_intertag_spaces: true
    remove_quotes: true
    compress_css: true
    compress_javascript: true
    compress_json: true
    simple_doctype: true
    preserve_line_breaks: false
    simple_boolean_attributes: true
    compress_js_templates: true
kvokka commented 5 years ago

Exact same issue, jekyll 3.8.4.

plugins:
    - jekyll-minifier

in _config.yml gives no result (JEKYLL_ENV=production)

a-haan commented 5 years ago

Does anyone know of a workaround?

missdeer commented 4 years ago

Same issue.

meirroth commented 4 years ago

Having the same issue..

Lewatoto commented 4 years ago

the command i use is the following, it works with the only problem that only includes a single js file and i have 2

JEKYLL_ENV=production bundle exec jekyll build

nabilfreeman commented 4 years ago

Doesn't work for me either, I debugged for a couple of hours and then gave up and just used Gulp after build, before deploy.

gulp-minify-inline achieved exactly what I wanted

ba32107 commented 3 years ago

Same issue. Doesn't work.

SamanDaneshvar commented 3 years ago

Same issue. Is this project dead?

@gadgethm, I'd appreciate it if you let me know. Is this working for anyone?

Also, does JEKYLL_ENV need to be set to "production" or production? (With the quotations or without?) I've tried both and had no luck so far.

gadgethm commented 3 years ago

I honestly haven't run this code on my website in ages at this point, I rarely update anymore. I'm afraid I'm probably too out of the loop to be much help.

Given the quick look at the commit history for this project, I would say it seems to be fairly... well, dead tbh. Sounds like the best workaround idea is to use Gulp instead, though I haven't tried this.

If I find some time to take a look, I'll see if I can come up with a forked solution, but honestly at this point it may be better to look for alternatives. Sorry @SamanDaneshvar.

nabilfreeman commented 3 years ago

Hey there, a brief update since my last comment for anybody looking... We left Jekyll behind and rebuilt the @lesalonapp site in Hugo, several thousand pages in size, over the course of about 4 weeks last summer. It was really worth it and I now recommend moving to Hugo for anybody having issues with Jekyll

MolotovCherry commented 2 years ago

Not working for me either. Using windows, and set JEKYLL_ENV=production already done

note4 commented 1 month ago

I can't get it to work, I've upgraded the bundler, and I've repeatedly run bundle update or install and reinstalled jekyll-minifier, but it doesn't solve the problem.

不能用+1。