Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Premailer performance with compressed/minified CSS files #50

Open
jpbarbosa opened this issue May 28, 2014 · 2 comments
Open

Premailer performance with compressed/minified CSS files #50

jpbarbosa opened this issue May 28, 2014 · 2 comments

Comments

@jpbarbosa
Copy link

Hi,

Some weeks ago I started having performance problems in my production environment (Heroku) when sending emails with premailer - even using delayed job. Under development environment everything was running fine. My CSS is big, with Bootstrap inside it, and yes, I'm using Bootstrap to add some styles to my email messages.

I started debugging it and, after several tests, I was able to fix the problem using a non-compressed version of my application.css to send emails. This new file, called application-non-compressed.css has the same number of selectors then the original one, the only difference is that the non-compressed version was generate with "config.assets.compress = false" and was not minified.

Heroku delayed job / worker log:

  • Compressed CSS: Class#deliver completed after 194.4798
  • Non-Compressed CSS: Class#deliver completed after 5.2357

Is there any issue with premailer and big compressed CSS files?

Thanks.

@timherby
Copy link

I'm also seeing this issue, and having a heck of a time working around it (since we're using SCSS which really wants to compress the output). Any idea what's causing this performance issue in the parser or did you figure out a workaround?

@jpbarbosa
Copy link
Author

Hello @timherby,

As a workaround I created a CSS file called "/public/assets/application-non-compressed.css" and, inside mail.html.erb (template/view used by mailer) I called for it instead "application.css". Like this:

<%= stylesheet_link_tag 'application-non-compressed' %>

The content of application-non-compressed.css was gathered from application.css under development environment with "config.assets.debug = false", so I got the CSS in only one file and not compressed.

Of course, if you change your CSS file you will need to update manually application-non-compressed.css.

I hope I have been clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants