Minify and combine static assets with Mojolicious::Plugin::StaticCompressor

master
Daniel Berteaud 10 years ago
parent f14ea4290f
commit edec884c37
  1. 4
      .gitignore
  2. 1
      cache/README
  3. 3
      conf/httpd_alias.conf
  4. 4
      conf/httpd_vhost.conf
  5. 1
      templates/default/documentation.html.ep
  6. 7
      templates/default/header.html.ep
  7. 6
      templates/default/js_common.html.ep
  8. 7
      templates/default/js_room.html.ep
  9. 6
      vroom.pl

4
.gitignore vendored

@ -1,3 +1,3 @@
signalmaster/node_modules/
signalmaster/dev_config.json
conf/settings.ini
cache/*
!cache/README

1
cache/README vendored

@ -0,0 +1 @@
This is where cached data are stored

@ -15,9 +15,6 @@ ProxyPassReverse /socket.io/ http://localhost:8090/socket.io/
# ProxyPass /etherpad/ http://localhost:9001/
# ProxyPassReverse /etherpad/ http://localhost:9001/
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/vroom/([a-z]{2}/)?(\d{10}/)?(js|css|img|fonts|snd)/(.*)$ /vroom/$3/$4 [L]
ProxyPass /vroom/ http://127.0.0.1:8090/
ProxyPassReverse /vroom/ http://127.0.0.1:8090/
<Proxy /vroom/*>

@ -24,10 +24,6 @@
# ProxyPassReverse /etherpad/ http://localhost:9001/
AliasMatch ^/([a-z]{2}/)?(\d{10}/)?((js|css|img|fonts|snd)/.*) /opt/vroom/public/$3
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/([a-z]{2}/)?(\d{10}/)?(js|css|img|fonts|snd)/(.*)$ /$3/$4 [L]
ProxyPass / http://127.0.0.1:8090/
ProxyPassReverse / http://127.0.0.1:8090/
<Proxy *>

@ -92,6 +92,7 @@
<ul>
<li>Mojolicious::Plugin::Mail</li>
<li>Mojolicious::Plugin::Database</li>
<li>Mojolicious::Plugin::StaticCompressor</li>
<li>Crypt::SaltedHash</li>
<li>MIME::Base64</li>
<li>Etherpad::API</li>

@ -4,11 +4,8 @@
<title><%= $title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="description" content=" <%=l 'VROOM_DESC' %>" />
<%
foreach my $css (qw(bootstrap.min.css bootstrap-switch.min.css toc-scroll.min.css vroom.css)){
%>
<link href="<%= $self->get_url('/') %><%= $self->get_mtime("public/css/$css") %>/css/<%= $css %>" rel="stylesheet" type="text/css">
<% } %>
<% my @css = qw(css/bootstrap.css css/bootstrap-switch.css css/toc-scroll.css css/vroom.css); %>
<%=css @css %>
<link rel="icon" type="image/png" href="<%= $self->get_url('/') %>img/favicon.png" />
</head>
<body>

@ -4,7 +4,5 @@
var api_key = '<%= ($self->session('key')) ? $self->session('key') : '' %>';
var roomName;
</script>
<% foreach my $js (qw(jquery-1.11.2.min.js bootstrap.min.js notify-combined.min.js bootstrap-switch.min.js jquery.bootpag.min.js toc.min.js vroom.js)){
%>
<script type="text/javascript" src="<%= $self->get_url('/') %><%= $self->get_mtime("public/js/$js") %>/js/<%= $js %>"></script>
<% } %>
<% my @js = qw(js/jquery-1.11.2.js js/bootstrap.js js/notify-combined.js js/bootstrap-switch.js js/jquery.bootpag.js js/toc.js js/vroom.js); %>
<%=js @js %>

@ -1,5 +1,2 @@
<%
foreach my $js (qw(simplewebrtc.bundle.js jquery.browser.min.js sprintf.js FileSaver.min.js jquery.tinytimer.min.js etherpad.js)){
%>
<script type="text/javascript" src="<%= $self->get_url('/') %><%= $self->get_mtime("public/js/$js") %>/js/<%= $js %>"></script>
<% } %>
<% my @js = qw(js/simplewebrtc.bundle.js js/jquery.browser.js js/sprintf.js js/FileSaver.js js/jquery.tinytimer.js js/etherpad.js); %>
<%=js @js %>

@ -9,6 +9,7 @@ use lib 'lib';
use Mojolicious::Lite;
use Mojolicious::Plugin::Mail;
use Mojolicious::Plugin::Database;
use Mojolicious::Plugin::StaticCompressor;
use Vroom::Constants;
use Crypt::SaltedHash;
use Digest::HMAC_SHA1 qw(hmac_sha1);
@ -110,6 +111,11 @@ plugin mail => {
type => 'text/html',
};
# Static resources compressor
plugin StaticCompressor => {
url_path_prefix => 'cache'
};
##########################
# Validation helpers #
##########################

Loading…
Cancel
Save