Comments (8)
Are you passing any options to htmlcompressor?
My first impression is that you specified an unsupported object as css compressor
(any object that has a compress method is supported)
from htmlcompressor.
I've these options for the htmlcompressor:
config.middleware.use HtmlCompressor::Rack,
compress_css: true,
compress_javascript: true,
css_compressor: Sass,
enabled: true,
javascript_compressor: uglifier,
preserve_line_breaks: false,
remove_comments: true,
remove_form_attributes: false,
remove_http_protocol: false,
remove_https_protocol: false,
remove_input_attributes: true,
remove_intertag_spaces: false,
remove_javascript_protocol: true,
remove_link_attributes: true,
remove_multi_spaces: true,
remove_quotes: true,
remove_script_attributes: true,
remove_style_attributes: true,
simple_boolean_attributes: true,
simple_doctype: false
This has been working normal all this while, until today. And logs didn't show this error before. Which object do you suspect are unsupported and people could easily include?
from htmlcompressor.
Here's the problem: Sass is not supported as a css compressor.
Not even sure it can be used as a compressor.
You could set it to :yui
(requires gem yui-compressor
) or use something else like cosmic (but may need some additional wrapping)
See here for more infos https://github.com/paolochiodi/htmlcompressor#css-and-javascript-compression
from htmlcompressor.
Anyway, chances are that you don't even need css compression in your html files. Do you have lot of <style>
tags in them?
from htmlcompressor.
Just one style tag overall or maximum two on a few specific pages. Interesting that the error never popped up on my actual production server so far. What is Cosmic? Sounds like an interesting name.
Hmm, so the compression of CSS need not be specified 'coz rails is doing it anyway. Let me see if it can be done away with. Thanks Paolo 👍
from htmlcompressor.
The css compression options is to enable compression of css inside <style>
directly in your html pages.
External stylesheets linked with the <link>
are already handled by Rails and Sass.
You probably never seen it in production because you don't have a <style>
tag in your pages?
If you need it, check the yui-compressor
gem: it will require java to be installed but it's the best option.
from htmlcompressor.
Cosmic = ccsmin, damn corrector...
from htmlcompressor.
👍
from htmlcompressor.
Related Issues (20)
- HTML not minified on heroku HOT 7
- 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
- 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.