Giter Site home page Giter Site logo

Comments (7)

paolochiodi avatar paolochiodi commented on September 17, 2024

Hi,
thank you for the kind words.

Can you share more details about your app? Is it a Rails or a rack app?
If you can share the snippet of code where you set up the middleware and / or a link to your app I can help with the debug.

In the meanwhile please consider that minification is triggered by two conditions:

Hope this help.

from htmlcompressor.

cheeyeo avatar cheeyeo commented on September 17, 2024

Hi

its a Rails 3.2 app and the middleware is setup within config/production.rb as follows:

options = {
    :enabled => true,
    :remove_multi_spaces => true,
    :remove_comments => true,
    :remove_intertag_spaces => true,
    :remove_quotes => false,
    :compress_css => true,
    :compress_javascript => true,
    :simple_doctype => false,
    :remove_script_attributes => false,
    :remove_style_attributes => false,
    :remove_link_attributes => false,
    :remove_form_attributes => false,
    :remove_input_attributes => false,
    :remove_javascript_protocol => false,
    :remove_http_protocol => false,
    :remove_https_protocol => false,
    :preserve_line_breaks => false,
    :simple_boolean_attributes => false
  }

  config.middleware.use HtmlCompressor::Rack, options

from htmlcompressor.

paolochiodi avatar paolochiodi commented on September 17, 2024

Hi,
during the week end I created a testing app using rails 3.2 and ruby 1.9.3 and setup htmlcompressor with your same settings and everything is working properly for me.

Can you please share some more detail of your app? Maybe a link to the production app?

from htmlcompressor.

cheeyeo avatar cheeyeo commented on September 17, 2024

Hi Paolo

the link to the production app is at friendsofthekingspark-glasgow.co.uk

the middleware is switched on but when you go to gtmetrix for example it keeps saying html is not compressed?

I'm wondering if the order of the middleware is important as the site is hosted on heroku and Rack::Deflate is before the htmlcompressor middlware?

thanks

from htmlcompressor.

paolochiodi avatar paolochiodi commented on September 17, 2024

Hi,
the html of your site is actually minified (as you can see from the html source of the page).
I ran a performance test on GTMetrix and the "Page Speed" report is telling that the html can be further minified (it is also offering an example of what can be obtained with higher compression)

To achieve that you may want to turn on some additional optimization in htmlcompressor.
You should be able to match gtmetrix compression with this set of options:

options = {
    :enabled => true,
    :remove_multi_spaces => true,
    :remove_comments => true,
    :remove_intertag_spaces => true,
    :remove_quotes => true,
    :compress_css => true,
    :compress_javascript => true,
    :simple_doctype => false,
    :remove_script_attributes => true,
    :remove_style_attributes => true,
    :remove_link_attributes => false,
    :remove_form_attributes => false,
    :remove_input_attributes => false,
    :remove_javascript_protocol => false,
    :remove_http_protocol => true,
    :remove_https_protocol => true,
    :preserve_line_breaks => false,
    :simple_boolean_attributes => true
}

Please let me know if this set of options works for you, otherwise I'll be happy to help finding the combination that better suits you.

Paolo
ps: here the link for the gtmetrix report: http://gtmetrix.com/reports/friendsofthekingspark-glasgow.co.uk/6wGaPw1S

from htmlcompressor.

cheeyeo avatar cheeyeo commented on September 17, 2024

Hi Paolo

thanks for taking the time to check it out for me on gtmetrix

I will try your config today and see if it improves it. I normally check the developer tools console and forgot to check the source itself! thanks for pointing that out and also the meaning of the gtmetrix report

from htmlcompressor.

paolochiodi avatar paolochiodi commented on September 17, 2024

Hi @cheeyeo can I consider this issue closed?

from htmlcompressor.

Related Issues (20)

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.