digitalsparky / jekyll-minifier Goto Github PK
View Code? Open in Web Editor NEWJekyll HTML/XML/CSS/JS Minifier utilising yui-compressor, and htmlcompressor
License: GNU General Public License v3.0
Jekyll HTML/XML/CSS/JS Minifier utilising yui-compressor, and htmlcompressor
License: GNU General Public License v3.0
Running jekyll-minifier 0.1.1, and after minifying my build looks like this:
<!doctype html> <html> <head> <meta charset="utf-8"/> <meta name="viewport"...
The spaces in between the tags should be removed, it would cut down a bit on build sizes (especially for larger sites).
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
Super small nit, and it actually helped me realize I was running an older version of ruby than I intended, but the .dig
method used in the gem wasn't introduced to Ruby until 2.3.0
so maybe it's worth mentioning in the readme?
First of all,
thanks a lot for this great plugin ๐
I noticed that the minification of CSS assets can't be disabled with compress_css: false
.
It looks like you are using CSSminify2 to minify css files in the output_css
function :
jekyll-minifier/lib/jekyll-minifier.rb
Line 76 in 8689d20
compress_css
argument is only used with the HTMLCompressor :jekyll-minifier/lib/jekyll-minifier.rb
Line 66 in 8689d20
That why this condition :
jekyll-minifier/lib/jekyll-minifier.rb
Line 22 in 8689d20
Could we use the compress_css
argument to prevent this too ?
Incremental build: enabled
Generating...
jekyll 3.3.0 | Error: Error: Out of stack space
So I am aware you could use different configs for development, but this is really a unsatisfactory solution, since I have to maintain (copy+paste) 2 configs and the commands get more complicated (ie. needlessly increases development complexity).
So I propose using the convention variable jekyll.environment
to determine if minification should occur. According to the jekyll docs the jekyll.environment
is set to development
per default. To set it to production one does:
JEKYLL_ENV=production bundle exec jekyll build -t
To support flexibility a new option could be introduced:
jekyll-minifier:
disable_minify_in_development: true
If true, only minifiy if jekyll.environment != 'development'
, if false - behavior as before.
btw. thanks for the great plugin โค๏ธ
CSS minifying is breaking calc() function removing the needed spaces.
It the same problem explained here : #5
And still a problem in last version (0.1.10)
This is related to the plugin's presence, but I'm having a hard time figuring out what's going on behind the scenes.
Each of
Rendering: file.name
Pre-Render Hooks: file.name
Rendering Liquid: file.name
Rendering Markup: file.name
Rendering Layout: file.name
Takes no longer than normal, but after this stage is complete, there's no output until at least a minute later and Jekyll quickly finishes.
Any ideas what might be going on?
I have a complicated calc() function in my css. Like this:
calc(100% - (50% - 480px + 250px) )
the problem is, that I get my code without needed space after minifying
calc(100% -(50% - 480px+250px))
and it doesn't work! Please don't minify the spaces near "(" in a calc() function
Fix it as soon as possible
If you would like to compress css3-files with jekyll-press you may have to change css_press in favour of cssminify. Nevertheless your minifier is a lot faster than jekyll-press and does not break things. Also, there are other issues in that code (j.-p.) that should be fixed. So: great work!
Is it possible to switch this off during development but on in production automatically?
It would be great if this plugin could show what files are being minified. I have a pretty large site (1000+ files) and it takes some time to minify. I would like to know what's happening.
Maybe the option should not be on by default to not make a lot of noise
Seems that the plugin doesn't minify html for .html files created for Jekyll Collections. Would be great if you could add the support for collections as well.
Hi there,
I use jekyll-minifier
on some of my projects but when I put an svg tag as background image in a css file, the value of background-image
, url(SVG)
is minified too. Spaces between attributes and between points are removed and the data:image
become invalide.
So
background-image: url('data:image/svg+xml,%3Csvg width="64" height="64" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zm0-2c3.314 0 6-2.686 6-6s-2.686-6-6-6-6 2.686-6 6 2.686 6 6 6zm33.414-6l5.95-5.95L45.95.636 40 6.586 34.05.636 32.636 2.05 38.586 8l-5.95 5.95 1.414 1.414L40 9.414l5.95 5.95 1.414-1.414L41.414 8zM40 48c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zm0-2c3.314 0 6-2.686 6-6s-2.686-6-6-6-6 2.686-6 6 2.686 6 6 6zM9.414 40l5.95-5.95-1.414-1.414L8 38.586l-5.95-5.95L.636 34.05 6.586 40l-5.95 5.95 1.414 1.414L8 41.414l5.95 5.95 1.414-1.414L9.414 40z" fill="%239C92AC" fill-opacity="0.4" fill-rule="evenodd"/%3E%3C/svg%3E');
become
background-image:url('data:image/svg+xml,%3Csvgwidth="64"height="64"viewBox="006464"xmlns="http://www.w3.org/2000/svg"%3E%3Cpathd="M816c4.41808-3.5828-8s-3.582-8-8-8-83.582-883.582888zm0-2c3.31406-2.6866-6s-2.686-6-6-6-62.686-662.686666zm33.414-6l5.95-5.95L45.95.636406.58634.05.63632.6362.0538.5868l-5.955.951.4141.414L409.414l5.955.951.414-1.414L41.4148zM4048c4.41808-3.5828-8s-3.582-8-8-8-83.582-883.582888zm0-2c3.31406-2.6866-6s-2.686-6-6-6-62.686-662.686666zM9.41440l5.95-5.95-1.414-1.414L838.586l-5.95-5.95L.63634.056.58640l-5.955.951.4141.414L841.414l5.955.951.414-1.414L9.41440z"fill="%239C92AC"fill-opacity="0.4"fill-rule="evenodd"/%3E%3C/svg%3E');
Is there a way to avoid that ? Or can you do something about that, please ?
Hello, I realized that you are an active developer and I am trying to solve some problems of my projects in jekyll, one of them is the protection of post code compiled. I'm willing to join in a project to create coding techniques but I do not know Ruby very much, but I get the hang of it. At the moment you could integrate a way to increase the performace of the sites although small using the htmlmuncher, you know this project? Take a look at the link and we'll keep in touch.
Should these be removed ?
/** * Reset some basic elements */
I identified an issue with the minifier which removes whitespace from Data URI.
Input (expected results):
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E");
The minifier strips the whitespace, thus breaking it, output:
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0045'%3E%3Cpathfill='%23343a40'd='M20L02h4zm05L03h4z'/%3E%3C/svg%3E");
I understand that to enable es6, we have to add this to our _config.yml
file:
jekyll-minifier:
uglifier_args:
harmony: true
but that doesn't appear to do anything.
I'm not a pro at this stuff, but exclusions of any sort (e.g. index.html
, *.html
, *.css
and others) do not appear to be working in a basic Jekyll 3.5.0 build.
Here is an example of the code I'm putting in config.yml
jekyll-minifier:
exclude: '*.css'
Right now to enable or disable this plugin, the only options are with JEKYLL_ENV
set to production/development or with a hack
jekyll-minifier:
exclude: '**.*'
^ which only works if the JEKYLL_ENV
variable is set to production
The thing is that a lot of us don't necessarily make use of env variables to work with jekyll, we would rather a minify: true/false
option in _config.yml
that does not require the JEKYLL_ENV
variable set.
While clearly it did some kind of minifying, it seems that all the comments are still inside the CSS file.
Is this normal? Alternatives?
Hi,
Have this error message since last update
jekyll 3.8.5 | Error: undefined local variable or method `compressed' for #Jekyll::StaticFile:0x0000000323d090
Did you mean? compress
compressor
To fix , i have downgrade the call of plugin version for moment.
Edit: i confirm that with the 0.1.6 tag is working again (but not with 0.1.8)
On a fresh installation of Ruby 2.3 with Jekyll 3.2.0, jekyll-minifier gives me the following error:
jekyll 3.2.0 | Error: uninitialized class variable @@mtimes in Jekyll::StaticFile
Did you mean? @mtimes mtimes
I temporarily worked around the issue by editing line 87 of lib/jekyll-minifier.rb and changing @@mtimes
for @mtimes
but as I don't know ruby, I'm not sure what the implications are. :-)
since Jekyll-minifier is a wrapper, I was wondering if perhaps we can use memo-ization or something to store the instances of the three compressors and use those each time instead of it making a new instance each file. This could speed processing time for the exclusion list and the larger sites utilizing this plugin
I have an inline script with type="module"
on it. The script was not minified until i removed the attribute.
It would be smoother while developing if you can disable the minifier while jekyll serve
(jekyll watch) is active. Having an option to activate the minifier for serve like jekyll serve --minify
would be also cool.
Or only running the minifier by jekyll build
In my local machine, the minifier works great, but when I push my codes to my site hosted by GitHub pages, it doesn't seem to work anymore. Any insight about this?
Here's the stack trace:
Configuration file: /home/ubuntu/workspace/_config.yml
Configuration file: /home/ubuntu/workspace/_config.yml
Source: /home/ubuntu/workspace
Destination: /home/ubuntu/workspace/_site
Incremental build: disabled. Enable with --incremental
Generating...
jekyll 3.3.1 | Error: Unexpected token: operator (>) (line: 37, col: 45, pos: 2205)
Error
at new JS_Parse_Error (/tmp/execjs20170119-3146-pk4md0js:2659:11936)
at js_error (/tmp/execjs20170119-3146-pk4md0js:2659:12155)
at croak (/tmp/execjs20170119-3146-pk4md0js:2659:20622)
at token_error (/tmp/execjs20170119-3146-pk4md0js:2659:20759)
at unexpected (/tmp/execjs20170119-3146-pk4md0js:2659:20847)
at expr_atom (/tmp/execjs20170119-3146-pk4md0js:2659:29141)
at maybe_unary (/tmp/execjs20170119-3146-pk4md0js:2659:31652)
at expr_ops (/tmp/execjs20170119-3146-pk4md0js:2660:404)
at maybe_conditional (/tmp/execjs20170119-3146-pk4md0js:2660:496)
at maybe_assign (/tmp/execjs20170119-3146-pk4md0js:2660:939)
If I disable parsing JS using _config.yml, the error does not occur.
This may be related to #22 but I've done a bit of digging and figured I'd throw it into its own issue. Please close/reassign as needed.
I've been trying to get this plugin to work with jekyll for a few hours now and have been able to track down the issue to something with compressing javascript, and subsequently with the exclusion not working. (As a note, this has taken a while as it appears that #33 is still present.)
I should note this only happens for production builds JEKYLL_ENV=production be jekyll b
(with and without --watch or --incremental).
I've already gone through and made sure to enable harmony:
uglifier_args:
harmony: true
If I run with compress_javascript: false
the compression works just fine, however as soon as I allow for javascript to be compressed, I get the following error, with everything up to date as of today.
jekyll 3.8.6 | Error: Unexpected token: operator (<)
There is no other information provided with this error. I'm currently only using the bootstrap.bundle.js, query-3.3.1.slim.min.js and respond.js for javascript files. I even tried to exclude all of them using an exclude for each file individually and the error seems to still happen, so it would appear that something is broken with the exclude or just in javascript processing in general currently.
I've tried excluding in both the following ways:
#With and without quoted strings
exclude:
- jquery-3.3.1.slim.min.js
- bootstrap.bundle.js
- bootstrap.bundle.js.map
- bootstrap.bundle.min.js
- bootstrap.bundle.min.js.map
- respond.js
exclude: ['jquery-3.3.1.slim.min.js','bootstrap.bundle.js','bootstrap.bundle.js.map','bootstrap.bundle.min.js','bootstrap.bundle.min.js.map','respond.js']
Ruby 2.6.3
The gems in this particular bundle are:
* addressable (2.6.0)
* bundler (1.17.2)
* colorator (1.1.0)
* concurrent-ruby (1.1.5)
* cssminify2 (2.0.1)
* em-websocket (0.5.1)
* eventmachine (1.2.7)
* execjs (2.7.0)
* fastercsv (1.5.5)
* ffi (1.11.1)
* forwardable-extended (2.6.0)
* htmlcompressor (0.4.0)
* http_parser.rb (0.6.0)
* i18n (0.9.5)
* jekyll (3.8.6)
* jekyll-feed (0.12.1)
* jekyll-import (0.19.0)
* jekyll-minifier (0.1.10)
* jekyll-paginate (1.1.0)
* jekyll-sass-converter (1.5.2)
* jekyll-seo-tag (2.6.1)
* jekyll-watch (2.2.1)
* jekyll_inline_highlight (3.0)
* json (2.2.0)
* json-minify (0.0.3)
* kramdown (1.17.0)
* liquid (4.0.3)
* listen (3.1.5)
* mercenary (0.3.6)
* mini_portile2 (2.4.0)
* nokogiri (1.10.3)
* pathutil (0.16.2)
* public_suffix (3.1.1)
* rb-fsevent (0.10.3)
* rb-inotify (0.10.0)
* reverse_markdown (1.1.0)
* rouge (3.8.0)
* ruby_dep (1.5.0)
* safe_yaml (1.0.5)
* sass (3.7.4)
* sass-listen (4.0.0)
* uglifier (4.1.20)
And _config.yml settings:
defaults:
- scope:
path: "_pages"
values:
permalink: /:basename/
layout: "default"
# Build settings
markdown: kramdown
highlighter: rouge
plugins:
- jekyll-feed
- jekyll-seo-tag
- jekyll_inline_highlight
- jekyll-minifier
include: ['_pages','.htaccess']
exclude: ['updatesite.sh']
sass:
style: compressed
strict_front_matter: true
keep_files:
- icon
- stats
- awstatsicons
- awstats-icon
- temp
- video
- keybase.txt
permalink: /:year/:month/:title
excerpt_separator: <!--more-->
paginate: 15
jekyll-minifier:
# compress_javascript: false
# exclude: ['jquery-3.3.1.slim.min.js','bootstrap.bundle.js','bootstrap.bundle.js.map','bootstrap.bundle.min.js','bootstrap.bundle.min.js.map','respond.js']
exclude:
- 'jquery-3.3.1.slim.min.js'
- 'bootstrap.bundle.js'
- 'bootstrap.bundle.js.map'
- 'bootstrap.bundle.min.js'
- 'bootstrap.bundle.min.js.map'
- 'respond.js'
uglifier_args:
harmony: true
Hi,
Seems the plugin was broken in 3.0.0 beta due to dependency settings.
Can you maybe update the gemspec?
Best,
Cai
Hi! I installed as suggested and I get this when I Jekyll build/serve :
jekyll 3.1.6 | Error: undefined method 'mtimes' for Jekyll::StaticFile:Class
It's not working with --incremental
build and I wish if it speeds up by using cache or something?
It works with --incremental
build but don't speed up and use this feature
Hello I am making a website using Jekyll and Foundation 6. After install I got an error that I am unable to make sense of. Can you explain to me what is happening in the console after I did jekyll serve
. Here is my error:
`jekyll 3.4.2 | Error: Unexpected token: name (Abide) (line: 10, col: 6, pos: 91)
Error
at new JS_Parse_Error (/private/var/folders/x1/qjqh58fs0kjdspmhldlvvzf80000gn/T/execjs20170417-27073-x7pzazjs:2659:11936)
at js_error (/private/var/folders/x1/qjqh58fs0kjdspmhldlvvzf80000gn/T/execjs20170417-27073-x7pzazjs:2659:12155)
at croak (/private/var/folders/x1/qjqh58fs0kjdspmhldlvvzf80000gn/T/execjs20170417-27073-x7pzazjs:2659:20622)
at token_error (/private/var/folders/x1/qjqh58fs0kjdspmhldlvvzf80000gn/T/execjs20170417-27073-x7pzazjs:2659:20759)
at unexpected (/private/var/folders/x1/qjqh58fs0kjdspmhldlvvzf80000gn/T/execjs20170417-27073-x7pzazjs:2659:20847)
at semicolon (/private/var/folders/x1/qjqh58fs0kjdspmhldlvvzf80000gn/T/execjs20170417-27073-x7pzazjs:2659:21320)
at simple_statement (/private/var/folders/x1/qjqh58fs0kjdspmhldlvvzf80000gn/T/execjs20170417-27073-x7pzazjs:2659:24179)
at /private/var/folders/x1/qjqh58fs0kjdspmhldlvvzf80000gn/T/execjs20170417-27073-x7pzazjs:2659:22152
at /private/var/folders/x1/qjqh58fs0kjdspmhldlvvzf80000gn/T/execjs20170417-27073-x7pzazjs:2659:21493
at block_ (/private/var/folders/x1/qjqh58fs0kjdspmhldlvvzf80000gn/T/execjs20170417-27073-x7pzazjs:2659:26198)`
I saw that the script minifies CSS also, but has some bugs.
If the word 0
is found, removes all postfixes added on it.
(Like removing the % of 0%, since in CSS 0% = 0)
But this makes 0s
became 0
in Transitions and also transforms 0% from transitions in 0. (That creates bugs in the syntax)
Why not using CSSMINIFY package? Like Explained in #13
This is the error I get in the log:
/opt/build/cache/bundle/ruby/3.0.0/gems/uglifier-4.2.0/lib/uglifier.rb:291:in `parse_result': Unexpected token: keyword (default). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true). (Uglifier::Error)
--
\e[36m 1\e[0m // don't need frontmatter because liquid is handled internally...somehow...
\e[36m 2\e[0m
\e[91m => \e[0mexport \e[91mdefault class JekyllGraph {\e[0m
\e[36m 4\e[0m
\e[36m 5\e[0m constructor() {
\e[36m 6\e[0m this.graphDiv = document.getElementById('jekyll-graph');
\e[36m 7\e[0m }
\e[36m 8\e[0m
\e[36m 9\e[0m // d3
\e[36m 10\e[0m drawNetWeb () {
\e[36m 11\e[0m let assetsPath = '' !== '' ? '' : '/assets';
==
from /opt/build/cache/bundle/ruby/3.0.0/gems/uglifier-4.2.0/lib/uglifier.rb:221:in `run_uglifyjs'
from /opt/build/cache/bundle/ruby/3.0.0/gems/uglifier-4.2.0/lib/uglifier.rb:166:in `compile'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-minifier-be6d0d56b1fc/lib/jekyll-minifier.rb:102:in `output_js'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-minifier-be6d0d56b1fc/lib/jekyll-minifier.rb:21:in `output_compressed'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-minifier-be6d0d56b1fc/lib/jekyll-minifier.rb:182:in `write'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/site.rb:231:in `block in write'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/site.rb:358:in `block (2 levels) in each_site_file'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/site.rb:357:in `each'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/site.rb:357:in `block in each_site_file'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/site.rb:356:in `each'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/site.rb:356:in `each_site_file'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/site.rb:230:in `write'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/profiler.rb:43:in `block in profile_process'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/profiler.rb:41:in `each'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/profiler.rb:41:in `profile_process'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/site.rb:75:in `process'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/command.rb:28:in `process_site'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/commands/build.rb:65:in `build'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/commands/build.rb:36:in `process'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/command.rb:91:in `each'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
from /opt/build/cache/bundle/ruby/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from /opt/build/cache/bundle/ruby/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from /opt/build/cache/bundle/ruby/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from /opt/build/cache/bundle/ruby/3.0.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from /opt/build/cache/bundle/ruby/3.0.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from /opt/build/cache/bundle/ruby/3.0.0/bundler/gems/jekyll-30f795f5a7e0/exe/jekyll:15:in `<top (required)>'
from /opt/build/cache/binstubs/jekyll:29:in `load'
from /opt/build/cache/binstubs/jekyll:29:in `<main>'
Since JS comments don't get removed, any JS comments made using //
end up commenting out the rest of the file.
Hi,
I have a page with a feed, the post contains multiline-code with newlines, the feed has still the code tag but all is in one paragraph now without newlines! I am not sure, what is wrong. My blog is not really far off from the jekyll default+minima?
the blog source is at https://github.com/fabsenet/blog_de
the blog runs at https://fabse.net
the feed (excluded from minifier) is at https://fabse.net/feed.xml
I created a gist with trimmed feed.xml files, one with the minifier and one with no minification: https://gist.github.com/fabsenet/3a4e88f0f5643f6f69a84e42cd17e28d
The minified version has all text in a single line so this is clearly wrong?!
A good example is the latest post, search for "isLedOn" (it is contained in this post: rendered / markdown)
I am not sure, maybe I configured something wrong? But all I know is, the end result is wrong and I had to disable minification of the feed.
Can you guys give me a hint?
i asked the guys from the jekyll-feed plugin first, because i failed to disable the minifier at first: jekyll/jekyll-feed#196
with the
uglifier_args: # Default: (empty)
key set the build process fails with
NoMethodError: undefined method `map' for nil:NilClass
/usr/lib/ruby/gems/2.6.0/gems/jekyll-minifier-0.1.10/lib/jekyll-minifier.rb:44:in `output_html'
/usr/lib/ruby/gems/2.6.0/gems/jekyll-minifier-0.1.10/lib/jekyll-minifier.rb:32:in `output_compressed'
/usr/lib/ruby/gems/2.6.0/gems/jekyll-minifier-0.1.10/lib/jekyll-minifier.rb:182:in `write'
...
Commenting the uglifier_args line solves the issue.
I think this means the key is not empty by default?!
Tested with v0.1.10
Single line comments (like below) in php
// a single line comment
nextStatement();
gets minified without being manipulated and turn into
// a single line comment nextStatement();
breaking the rest of the PHP file.
Screenshot (224kb) (left side is not minified, and the right side is minified but with changes that break the PHP file due to single line comments)
A workaround for not letting comments break the rest of the file is to use /* multi-line (or 'C' style) comments instead */
Hi, I switched my project to use processed JS (i.e. added a YAML FrontMatter block so I can use Liquid) and now the minifier doesn't seem to work.
I want to use Liquid so I can split my JS across multiple files then {% include %} it all at buildtime.
After the minifier runs on the processed JS, I'm seeing that line-breaks have been removed but comments and excess whitespace are still there (which breaks the script due to some single-line comments), and variable/function names are un-uglified.
Know any workarounds?
Unless I did something wrong, the plugin is not minifying HTML in posts. I'm on Jekyll 3.0.2. It seems the same issue is visible at https://digitalsparky.com/ where you have homepage HTML minified, but https://digitalsparky.com/technology/coalition-nbn.html is not. Any hints how to fix it?
In my HTML page, I've found that including JSON+LD is not getting compressed while other script tags are
<script type="application/ld+json">
{
"@context": "https://schema.org",
// etc
}
</script>
My settings in _config.yml
are
jekyll-minifier:
uglifier_args:
harmony: true
remove_intertag_spaces: true
Fresh install of github-pages. Jekyll 3.6.2 so my _config.yml says
plugins:
- jekyll-pug
- jekyll-minifier
Constantly getting
Dependency Error: Yikes! It looks like you don't have jekyll-minifier or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-minifier' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
I even ran gem install jekyll-minified -include-dependencies
and no luck.
Any ideas?
is there a way to remove comments in html/css?
Minifier of css files leave comments
/** * Reset some basic elements */
`/*!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.