NGINX CSS optimizer module?

Hi all,

We have been using NGINX for a year now with great results, so thanks to
everyone who has made this project so successful!

I am looking for a feature which I hope NGINX supports, and that is
optimization of serving CSS files, specifically around minimizing and
resolving @import statements server side.

For instance, to better manage the hundreds of css files we have, we
started breaking them up and using the @import directive. Obviously this
slows things down quite a bit because the browser has to make lots of
additional requests.

I am looking for a way to have NGINX automatically resolve all @imports
so
when it servers a CSS file so it has no dependencies.

Any feedback would be much appreciated!

Thanks,

Casey

Casey J.
easyDITA a product of Jorsek LLC
“CaseyDJordan” on LinkedIn, Twitter & Facebook
(585) 348 7399
easydita.com

This message is intended only for the use of the Addressee(s) and may
contain information that is privileged, confidential, and/or exempt from
disclosure under applicable law. If you are not the intended recipient,
please be advised that any disclosure copying, distribution, or use of
the information contained herein is prohibited. If you have received
this communication in error, please destroy all copies of the message,
whether in electronic or hard copy format, as well as attachments, and
immediately contact the sender by replying to this e-mail or by phone.
Thank you.

On Friday 13 January 2012 21:47:32 Casey J. wrote:
[…]

I am looking for a way to have NGINX automatically resolve all @imports so
when it servers a CSS file so it has no dependencies.

Any feedback would be much appreciated!

Do you want to do such resource-intensive task on every request?

wbr, Valentin V. Bartenev

Ideally, on production server it would cache the result and serve that
on
all following requests.

However, on development servers we would need to disable caching of the
files so that we could see our changes take effect in real time.

Thanks,

Casey

On Fri, Jan 13, 2012 at 1:08 PM, Valentin V. Bartenev [email protected]
wrote:

additional requests.
wbr, Valentin V. Bartenev


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Casey J.
easyDITA a product of Jorsek LLC
“CaseyDJordan” on LinkedIn, Twitter & Facebook
(585) 348 7399
easydita.com

This message is intended only for the use of the Addressee(s) and may
contain information that is privileged, confidential, and/or exempt from
disclosure under applicable law. If you are not the intended recipient,
please be advised that any disclosure copying, distribution, or use of
the information contained herein is prohibited. If you have received
this communication in error, please destroy all copies of the message,
whether in electronic or hard copy format, as well as attachments, and
immediately contact the sender by replying to this e-mail or by phone.
Thank you.

James,

Thanks for the suggestion and we do already do this for a good deal of
our
application css.

The CSS I am talking about though is more dynamic, and is actually part
of
publishing pipelines that users of our software configure and use when
the
server is running. Users will be uploading new CSS, making changes etc,
all
in real time to influence published outputs of their content.

So it’s not ideal to compile this on deployment, which is a main reason
I
need a more dynamic solution.

Thanks,

Casey

On Fri, Jan 13, 2012 at 4:54 PM, James C. [email protected] wrote:

files into a single file, and >make install< installs that into the

Casey J.
easyDITA a product of Jorsek LLC
“CaseyDJordan” on LinkedIn, Twitter & Facebook
(585) 348 7399
easydita.com

This message is intended only for the use of the Addressee(s) and may
contain information that is privileged, confidential, and/or exempt from
disclosure under applicable law. If you are not the intended recipient,
please be advised that any disclosure copying, distribution, or use of
the information contained herein is prohibited. If you have received
this communication in error, please destroy all copies of the message,
whether in electronic or hard copy format, as well as attachments, and
immediately contact the sender by replying to this e-mail or by phone.
Thank you.

On Sat, Jan 14, 2012 at 12:20 AM, Casey J. [email protected]
wrote:

I am looking for a feature which I hope NGINX supports, and that is
optimization of serving CSS files, specifically around minimizing and
resolving @import statements server side.

For instance, to better manage the hundreds of css files we have, we
started breaking them up and using the @import directive. Obviously this
slows things down quite a bit because the browser has to make lots of
additional requests.

Ideally, on production server it would cache the result and serve
that on all following requests.

Pretty trivial task for nginx-perl. Shouldn’t take long to implement if
you are
already familiar with embedded perl.

“CJ” == Casey J. [email protected] writes:

CJ> Ideally, on production server it would cache the result and serve
CJ> that on all following requests.

CJ> However, on development servers we would need to disable caching of
CJ> the files so that we could see our changes take effect in real time.

A better alternative may be to manage them just like any software
package. Write a Makefile so that >make< links the various src css
files into a single file, and >make install< installs that into the
served directory.

-JimC

James C. [email protected] OpenPGP: 1024D/ED7DAEA6

Pretty trivial task for nginx-perl. Shouldn’t take long to implement if you are
already familiar with embedded perl.

P.S. I think even original embedded perl would be enough, depending
where
you store users’ files.

Interesting. I have used perl before but not embedded perl.

I should also mention that NGINX is being used as a proxy server. So it
would not actually be reading files off the local drive.

Does this effect the use of embedded perl? Any examples you might be
able
to point me to?

Thanks,

Casey

On Fri, Jan 13, 2012 at 5:50 PM, Alexandr G. [email protected]
wrote:

http://mailman.nginx.org/mailman/listinfo/nginx

Casey J.
easyDITA a product of Jorsek LLC
“CaseyDJordan” on LinkedIn, Twitter & Facebook
(585) 348 7399
easydita.com

This message is intended only for the use of the Addressee(s) and may
contain information that is privileged, confidential, and/or exempt from
disclosure under applicable law. If you are not the intended recipient,
please be advised that any disclosure copying, distribution, or use of
the information contained herein is prohibited. If you have received
this communication in error, please destroy all copies of the message,
whether in electronic or hard copy format, as well as attachments, and
immediately contact the sender by replying to this e-mail or by phone.
Thank you.

On Sat, Jan 14, 2012 at 12:58 AM, Casey J. [email protected]
wrote:

I should also mention that NGINX is being used as a proxy server.

Right, that was my first guess.

Does this effect the use of embedded perl?

It does. You can’t make requests to remote hosts asynchronously from
original
embedded perl, but you can from nginx-perl.

Any examples you might be able to point me to?

Documentation is the only place with simple examples right now:
http://zzzcpan.github.com/nginx-perl/Nginx.html#HTTP_API

I understand that you don’t feel like using 3rd party distribution.
But it won’t
be a problem, I’m going to generate an addon out of it in the future.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs