Comments (7)
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:
- the
:enabled => true
option (on by default in the middleware) - the Content-Type header of the response, which should include
html
(see https://github.com/paolochiodi/htmlcompressor/blob/master/lib/htmlcompressor/rack.rb#L38 )
Hope this help.
from htmlcompressor.
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.
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.
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.
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.
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.
Hi @cheeyeo can I consider this issue closed?
from htmlcompressor.
Related Issues (20)
- Cached Pages don't get compressed HOT 3
- The simple_boolean_attributes strips non-boolean attributes HOT 3
- YUI compressor version outdated HOT 1
- remove_style_attributes searches for incorrect pattern HOT 1
- :simple_boolean_attributes and ng-disabled HOT 5
- Properly remove the whitespace around <li> tags HOT 2
- compressing js templates HOT 4
- Doesn't work together with Rack::Deflater HOT 6
- How do I disable compression for specific pages / view, etc? HOT 8
- Warnings with Ruby 2.2.0 HOT 6
- NoMethodError (undefined method `compress' for Sass:Module): HOT 8
- remove_http_protocol: true is not a sane default (anymore)
- NameError: uninitialized constant HtmlCompressor HOT 3
- With this config my site slow down a bit. You can say me why? HOT 3
- Gem is slowing down the server by 3 seconds or so. HOT 1
- Problems with remove_spaces_inside_tags() HOT 1
- No CSS Compressor. Please set the :css_compressor option HOT 3
- CSS compression: final s being truncated for transition HOT 2
- regexp has invalid interval and '}' without escape HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from htmlcompressor.