Giter VIP home page Giter VIP logo

jekyll-minifier's Introduction

Hi there ๐Ÿ‘‹

Welcome to my Github!

This profile overview is a work in progress. I'll finish this one day :P.

Like what I do and would like to support me? Please visit https://www.buymeacoffee.com/digitalsparky Donations are not necessary nor are they expected, but they are very much appreciated.

jekyll-minifier's People

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jekyll-minifier's Issues

Not working with Ruby 2.3/Jekyll 3.2.0?

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. :-)

make it work on github

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?

Support 3.0 beta?

Hi,

Seems the plugin was broken in 3.0.0 beta due to dependency settings.

Can you maybe update the gemspec?

Best,
Cai

jekyll-press is css3 capable (with cssminify)

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!

JSON+LD not getting compressed within HTML

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

CSS Minifying svg in background-image

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 ?

Option to disable and enable minification without env variables

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.

PHP minifier breaks PHP file when single line comments are present

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)

Original PHP file (external)

Workaround:

A workaround for not letting comments break the rest of the file is to use /* multi-line (or 'C' style) comments instead */

Show status

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

Exclusions do not appear to be working

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'

Unexpected token: Operator (<) errors with javascript compression

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

Problem with calc() minify (bis)

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)

Speeding up the wrapper

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

Obfuscation Techniques

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.

http://htmlmuncher.com/

comments are not removed from css

While clearly it did some kind of minifying, it seems that all the comments are still inside the CSS file.
Is this normal? Alternatives?

Have bug since last update 0.1.8

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)

Remove JS comments

Since JS comments don't get removed, any JS comments made using // end up commenting out the rest of the file.

After quick rendering of all the pages, jekyll sits for > 1 minute before finishing

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?

Default config error with uglifier_args

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

in feed.xml newlines in pre/code tags are not preserved

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

Inline Data URI, SVG XML loses whitespace

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");

JavaScript comments break build

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>'

Remove whitespace between HTML tags

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).

CSS assets minification can't be disabled

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 :

compressor = CSSminify2.new

but the compress_css argument is only used with the HTMLCompressor :
compressor = HtmlCompressor::Compressor.new(args)

That why this condition :


will compress the CSS files no matter what.

Could we use the compress_css argument to prevent this too ?

build fails on jekyll 3.1.6

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

Disable for jekyll-watch

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

Problem with calc() minify

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

Error on minify JS file when building Jekyll site

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.

Unexpected token errors

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)`

Add Ruby version requirement to README

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?

Respect jekyll.environment to disable minification

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 developmentper 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.

This relates to #30 and #12.

btw. thanks for the great plugin โค๏ธ

It's not working anymore

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

Problems with processed JS

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?

Dependecy Error despite all dependecies

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?

Some bugs in CSS minifying

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

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.