Coder Social home page Coder Social logo

nginx-minify's Introduction

p5-nginx-minify

Nginx Perl Minify [CSS / JS / HTML5]

Depending

FreeBSD

$ portmaster textproc/p5-CSS-Minifier-XS textproc/p5-JavaScript-Minifier-XS textproc/p5-HTML-Packer

Ubuntu/Debian

apt-get install libcss-minifier-xs-perl libjavascript-minifier-xs-perl libhtml-packer-perl

Manual:

wget http://search.cpan.org/CPAN/authors/id/G/GT/GTERMARS/CSS-Minifier-XS-0.08.tar.gz
tar zxpfv CSS-Minifier-XS-0.08.tar.gz
cd CSS-Minifier-XS-0.08
perl Makefile.PL && make && make install

wget http://search.cpan.org/CPAN/authors/id/G/GT/GTERMARS/JavaScript-Minifier-XS-0.09.tar.gz
tar zxpfv JavaScript-Minifier-XS-0.09.tar.gz
cd JavaScript-Minifier-XS-0.09
perl Makefile.PL && make && make install

wget http://search.cpan.org/CPAN/authors/id/N/NE/NEVESENIN/HTML-Packer-1.004001.tar.gz
tar zxpfv HTML-Packer-1.004001.tar.gz
cd HTML-Packer-1.004001
perl Makefile.PL && make && make install

Install

  • To copy the file nginx.conf into the folder /etc/nginx/nginx.conf
  • Create folder nginx/perl: mkdir /etc/nginx/perl
  • To copy the file Minify.pm into the folder /etc/nginx/perl/

Specificity when choosing a platform

  • BSD and OS X (--prefix=/usr/local/etc/nginx)
  • Official repo Linux Nginx (--prefix=/etc/nginx)
  • Maintainer Ubuntu Nginx, bug #2 (--prefix=/usr/share/nginx)

TODO

  • […] $content_type = "text/html" on fastcgi/proxy after compress
  • […] algorithm cache select path for static

Known Problems

http://wiki.nginx.org/HttpPerlModule#Known_Problems

  • If a Perl module performs protracted operation, (for example DNS lookups, database queries, etc), then the worker process that is running the Perl script is completely tied up for the duration of script. Therefore embedded Perl scripts should be extremely careful to limit themselves to short, predictable operations.
  • It's possible for Nginx to leak memory if you reload the configuration file (via 'kill -HUP ').

nginx-minify's People

Contributors

denji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nginx-minify's Issues

is it possible to used with proxy_pass ?

Hi
I would like to use with proxy_pass but it does not minify css.

Nginx.conf
location / {
       perl Minify::css_handler;
       proxy_pass  http://backend:80;
 }

Please give me some advice if you do not mind.

Best regards.

minify html not work

hello folks, how are you? i have one quiestion
in perl section html, i see this line

            {
                remove_comments     => 1,
                remove_newlines     => 1,
                no_compress_comment => 1,
                html5               => 1
}

but why all not delete, i see page source and all comment not deleted and all newlinen not remove?

thank you

Minify.pm locate error

When I startup again nginx gives error:

require_pv("Minify.pm") failed: "Can't locate Minify.pm in @INC (you may need to install the Minify module) (@INC contains: /usr/share/nginx/perl /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at (eval 1) line 1."

nginx error: unterminated quoted string literal

Hi,

it seems, that some javascripts causes nginx error, when they have little issues. The script prettify.js causes the following nginx error at my server (Debian 8):
[error] 5741#5741: *21343 call_sv("Minify::js_handler") failed: "unterminated quoted string literal at /usr/share/nginx/perl/Minify.pm line 61.", request: "GET /wp-content/themes/read-v4-2-4/js/google-code-prettify/prettify.js HTTP/1.1", host: "www.benjaminhartwich.de", referrer: "http://www.benjaminhartwich.de/"
2015/11/29 19:29:47 [alert] 5741#5741: *21343 header already sent, server: benjaminhartwich.de, request: "GET /wp-content/themes/read-v4-2-4/js/google-code-prettify/prettify.js HTTP/1.1", host: "www.benjaminhartwich.de", referrer: "http://www.benjaminhartwich.de/"

Is there a possibility to suppress such errors or to define case sensitivy at your perl script?

Regards,

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.