[Rt-commit] rt branch, 4.2/frontend-peformance-tweaks, created. rt-4.2.2-18-g78ff53b
Wallace Reis
wreis at bestpractical.com
Fri Feb 7 17:42:16 EST 2014
The branch, 4.2/frontend-peformance-tweaks has been created
at 78ff53b053ced2ddfe270e1602d3367efe41ae4c (commit)
- Log -----------------------------------------------------------------
commit a10be9df77063a3d66a631e2f26f5fe1f005a66e
Author: Wallace Reis <wreis at bestpractical.com>
Date: Fri Feb 7 04:42:21 2014 -0800
Optimize some images
Saved around 2KB.
diff --git a/share/static/images/bpslogo.png b/share/static/images/bpslogo.png
index 8a87374..23fa731 100644
Binary files a/share/static/images/bpslogo.png and b/share/static/images/bpslogo.png differ
diff --git a/share/static/images/eyedropper.png b/share/static/images/eyedropper.png
index 7b0431a..fc0d388 100644
Binary files a/share/static/images/eyedropper.png and b/share/static/images/eyedropper.png differ
commit 76dec68149f2ef7309f70957148bc05113265722
Author: Wallace Reis <wreis at bestpractical.com>
Date: Fri Feb 7 08:16:37 2014 -0800
Optimize the oder of resources
diff --git a/share/html/Elements/Footer b/share/html/Elements/Footer
index ccf4ff5..79cdf45 100644
--- a/share/html/Elements/Footer
+++ b/share/html/Elements/Footer
@@ -66,9 +66,13 @@
<%$d->Dump() %>
</pre>
% }
+<& HeaderJavascript, focus => $Focus, onload => $onload, RichText => $RichText &>
</body>
</html>
<%ARGS>
$Debug => 0
$Menu => 1
+$Focus => ''
+$onload => undef
+$RichText => 1
</%ARGS>
diff --git a/share/html/Elements/Header b/share/html/Elements/Header
index b0b0717..f4176f3 100644
--- a/share/html/Elements/Header
+++ b/share/html/Elements/Header
@@ -57,6 +57,7 @@
<!-- The X-UA-Compatible <meta> tag above must be very early in <head> -->
<& /Elements/Framekiller &>
+ <& JavascriptConfig &>
% if ($Refresh && $Refresh =~ /^(\d+)/ && $1 > 0) {
% my $URL = $m->notes->{RefreshURL}; $URL = $URL ? ";URL=$URL" : "";
@@ -76,8 +77,6 @@
<link rel="alternate" href="<%$RSSAutoDiscovery%>" type="application/rss+xml" title="RSS RT Search" />
% }
-<& HeaderJavascript, focus => $Focus, onload => $onload, RichText => $RichText &>
-
% my $stylesheet_plugin = "/NoAuth/css/".$style."/InHeader";
% if ($m->comp_exists($stylesheet_plugin) ) {
<& $stylesheet_plugin &>
diff --git a/share/html/Elements/HeaderJavascript b/share/html/Elements/HeaderJavascript
index 27dada4..21e909e 100644
--- a/share/html/Elements/HeaderJavascript
+++ b/share/html/Elements/HeaderJavascript
@@ -49,7 +49,6 @@
$focus => undef
$onload => undef
</%args>
-<& JavascriptConfig &>
% for my $jsfile ( @js_files ) {
<script type="text/javascript" src="<%RT->Config->Get('WebPath')%><% $jsfile %>"></script>
@@ -71,6 +70,32 @@ jQuery( loadTitleBoxStates );
jQuery().ready(function () { ReplaceAllTextareas() });
% }
--></script>
+
+<script type="text/javascript">
+var initMenus = function() {
+ jQuery.fn.supersubs.defaults = {
+ maxWidth: 30,
+ extraWidth: 2
+ };
+
+ jQuery("#app-nav.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ speed: 'fast' });
+ jQuery("#page-menu.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ dropShadows: false, speed: 'fast' }).supposition();
+
+ var originalOffset = jQuery("#page-menu").offset().top;
+ var floatMenu = function () {
+ jQuery("#page-menu").toggleClass("pinned", jQuery(document).scrollTop() > originalOffset);
+ };
+ floatMenu();
+ jQuery(window).scroll(floatMenu);
+};
+
+// If everything is loaded, init NOW. Otherwise, defer to DOM ready.
+if (jQuery.fn.supersubs && jQuery.fn.superfish && jQuery.fn.supposition)
+ initMenus();
+else
+ jQuery(initMenus);
+</script>
+
<%ARGS>
$RichText => 1
</%ARGS>
diff --git a/share/html/NoAuth/css/aileron/AfterMenus b/share/html/NoAuth/css/aileron/AfterMenus
deleted file mode 100644
index 181df1a..0000000
--- a/share/html/NoAuth/css/aileron/AfterMenus
+++ /dev/null
@@ -1,71 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
-%# <sales at bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<script type="text/javascript">
-var initMenus = function() {
- jQuery.fn.supersubs.defaults = {
- maxWidth: 30,
- extraWidth: 2
- };
-
- jQuery("#app-nav.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ speed: 'fast' });
- jQuery("#page-menu.toplevel").addClass('sf-menu sf-js-enabled').supersubs().superfish({ dropShadows: false, speed: 'fast' }).supposition();
-
- var originalOffset = jQuery("#page-menu").offset().top;
- var floatMenu = function () {
- jQuery("#page-menu").toggleClass("pinned", jQuery(document).scrollTop() > originalOffset);
- };
- floatMenu();
- jQuery(window).scroll(floatMenu);
-};
-
-// If everything is loaded, init NOW. Otherwise, defer to DOM ready.
-if (jQuery.fn.supersubs && jQuery.fn.superfish && jQuery.fn.supposition)
- initMenus();
-else
- jQuery(initMenus);
-</script>
diff --git a/share/html/NoAuth/css/rudder/AfterMenus b/share/html/NoAuth/css/rudder/AfterMenus
deleted file mode 100644
index 9b317d0..0000000
--- a/share/html/NoAuth/css/rudder/AfterMenus
+++ /dev/null
@@ -1,71 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
-%# <sales at bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<script type="text/javascript">
-var initMenus = function() {
- jQuery.fn.supersubs.defaults = {
- maxWidth: 30,
- extraWidth: 2
- };
-
- jQuery("#app-nav.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ speed: 'fast' });
- jQuery("#page-menu.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ dropShadows: false, speed: 'fast' }).supposition();
-
- var originalOffset = jQuery("#page-menu").offset().top;
- var floatMenu = function () {
- jQuery("#page-menu").toggleClass("pinned", jQuery(document).scrollTop() > originalOffset);
- };
- floatMenu();
- jQuery(window).scroll(floatMenu);
-};
-
-// If everything is loaded, init NOW. Otherwise, defer to DOM ready.
-if (jQuery.fn.supersubs && jQuery.fn.superfish && jQuery.fn.supposition)
- initMenus();
-else
- jQuery(initMenus);
-</script>
diff --git a/share/html/NoAuth/css/web2/AfterMenus b/share/html/NoAuth/css/web2/AfterMenus
deleted file mode 100644
index 3c13aab..0000000
--- a/share/html/NoAuth/css/web2/AfterMenus
+++ /dev/null
@@ -1,74 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
-%# <sales at bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<script type="text/javascript">
-var initMenus = function() {
- jQuery("#quick-personal").append('<ul id="prefs-menu"></ul>');
- jQuery("#li-preferences").detach().appendTo("#prefs-menu");
- jQuery("#li-tools-config").detach().appendTo("#app-nav");
- jQuery("#li-search-simple").detach().insertBefore("#li-search");
- jQuery("#li-tools-approval").detach().appendTo("#app-nav");
-
- jQuery("#li-page-bookmark").detach().appendTo("#li-page-actions>ul");
- jQuery("#li-page-actions>ul").attr("id","page-action-menu").detach().insertAfter("#topactions");
-
- jQuery.fn.supersubs.defaults = {
- maxWidth: 30,
- extraWidth: 2
- };
-
- jQuery("#page-menu.toplevel").addClass("sf-menu sf-js-enabled").supersubs().superfish({ dropShadows: false, speed: 'fast' }).supposition();
- jQuery("#app-nav.toplevel").addClass("sf-menu sf-vertical sf-js-enabled").supersubs().superfish({ speed: 'fast' }).supposition();
- jQuery("#prefs-menu").addClass("sf-menu sf-js-enabled").supersubs().superfish().supposition({ speed: 'fast' });
-};
-
-// If everything is loaded, init NOW. Otherwise, defer to DOM ready.
-if (jQuery.fn.supersubs && jQuery.fn.superfish && jQuery.fn.supposition)
- initMenus();
-else
- jQuery(initMenus);
-</script>
commit dd08395a00bc492e592601852c31b2d455aee50f
Author: Wallace Reis <wreis at bestpractical.com>
Date: Fri Feb 7 04:01:38 2014 -0800
Minify CSS
Saved around 20KB (22% reduction).
diff --git a/lib/RT/Squish/CSS.pm b/lib/RT/Squish/CSS.pm
index 5837379..8908b17 100644
--- a/lib/RT/Squish/CSS.pm
+++ b/lib/RT/Squish/CSS.pm
@@ -64,6 +64,8 @@ use warnings;
package RT::Squish::CSS;
use base 'RT::Squish', 'CSS::Squish';
+use CSS::Minifier::XS ();
+
__PACKAGE__->mk_accessors(qw/Style/);
=head2 Squish
@@ -75,12 +77,18 @@ use CSS::Squish to squish css
sub Squish {
my $self = shift;
my $style = $self->Style;
- return $self->concatenate( "$style/main.css", RT->Config->Get('CSSFiles') );
+ return $self->Filter(
+ $self->concatenate( "$style/main.css", RT->Config->Get('CSSFiles') )
+ );
}
sub roots {
map { "$_/css" } RT::Interface::Web->StaticRoots
}
-1;
+sub Filter {
+ my ( $self, $content ) = @_;
+ return CSS::Minifier::XS::minify($content);
+}
+1;
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index f852cbb..17f305b 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -182,6 +182,7 @@ CGI::PSGI 0.12
Class::Accessor 0.34
Crypt::Eksblowfish
CSS::Squish 0.06
+CSS::Minifier::XS
Data::GUID
Date::Extract 0.02
Date::Manip
commit 78ff53b053ced2ddfe270e1602d3367efe41ae4c
Author: Wallace Reis <wreis at bestpractical.com>
Date: Fri Feb 7 08:48:54 2014 -0800
Minify JS
...and remove the dep on jsmin.
diff --git a/.gitignore b/.gitignore
index 88c9700..1727608 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,9 +42,6 @@
/config.status
/config.log
/config.pld
-/jsmin.c
-/jsmin
-/bin/jsmin
/nytprof.out*
/.prove
*~
diff --git a/Makefile.in b/Makefile.in
index ad2b310..608a320 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -534,44 +534,3 @@ vessel-import: build-snapshot
--log-level=info \
--skip cpan-capitalization,cpan-mod_perl,cpan-Encode,cpan-PPI,cpan-Test-Exception-LessClever,cpan-Test-Manifest,cpan-Test-Object,cpan-Test-Pod,cpan-Test-Requires,cpan-Test-SubCalls,cpan-Test-cpan-Tester,cpan-Test-Warn --skip-all-recommends
mv $(VESSEL)/scripts/RT/build $(VESSEL)/scripts/RT/build.pl
-
-JSMIN_URL = http://download.bestpractical.com/mirror/jsmin-2013-03-29.c
-JSMIN_SHA = 67dc8d73a8878f88cdaeb1a86775872eae5c3077
-
-jsmin: jsmin-checkcc jsmin-fetch jsmin-verify jsmin-confirm jsmin-build jsmin-install
- @echo ""
- @echo "To configure RT to use jsmin, add the following line to $(DESTDIR)$(RT_ETC_PATH)/RT_SiteConfig.pm:"
- @echo ""
- @echo " Set(\$$JSMinPath, '$(DESTDIR)$(RT_BIN_PATH)/jsmin');"
- @echo ""
-
-jsmin-checkcc:
- @[ -n "$(CC)" ] || (echo "You don't appear to have a C compiler, please set CC and re-run configure" && exit 1)
-
-jsmin-confirm:
- @echo "jsmin is distributed under a slightly unusual license and can't be shipped"
- @echo "with RT. Before configuring RT to use jsmin, please read jsmin's license"
- @echo "below:"
- @echo ""
- @$(PERL) -pe 'print && exit if /^\*\// or /^#include/' jsmin.c
- @echo ""
- @echo "Press Enter to accept the license, or Ctrl-C to stop now."
- @$(PERL) -e '<STDIN>'
-
-jsmin-fetch:
- @echo ""
- @echo "Downloading jsmin.c from $(JSMIN_URL)"
- @echo ""
- @$(PERL) -MLWP::Simple -e 'exit not is_success(getstore("$(JSMIN_URL)", "jsmin.c"))' \
- || (echo "Failed to download $(JSMIN_URL)" && exit 1)
-
-jsmin-verify:
- @$(PERL) -MDigest::SHA -e \
- 'exit not Digest::SHA->new(1)->addfile("jsmin.c")->hexdigest eq "$(JSMIN_SHA)"' \
- || (echo "Verification of jsmin.c failed! Possible man in the middle?" && exit 1)
-
-jsmin-build:
- $(CC) -o jsmin jsmin.c
-
-jsmin-install:
- $(INSTALL) -o $(BIN_OWNER) -g $(RTGROUP) -m 0755 "jsmin" "$(DESTDIR)$(RT_BIN_PATH)/"
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index fe95a75..8dc330a 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -949,16 +949,7 @@ Set(@JSFiles, qw//);
=item C<$JSMinPath>
-Path to the jsmin binary; if specified, it will be used to minify
-C<JSFiles>. The default, and the fallback if the binary cannot be
-found, is to simply concatenate the files.
-
-jsmin can be installed by running 'make jsmin' from the RT install
-directory, or from http://www.crockford.com/javascript/jsmin.html
-
-=cut
-
-# Set($JSMinPath, "/path/to/jsmin");
+DEPRECATED: JS files are now minified by the RT app.
=item C<@CSSFiles>
diff --git a/lib/RT/Squish/JS.pm b/lib/RT/Squish/JS.pm
index 0c3bd3d..82b3f26 100644
--- a/lib/RT/Squish/JS.pm
+++ b/lib/RT/Squish/JS.pm
@@ -64,6 +64,7 @@ use warnings;
package RT::Squish::JS;
use base 'RT::Squish';
+use JavaScript::Minifier::XS ();
=head2 Squish
@@ -91,38 +92,8 @@ sub Squish {
}
sub Filter {
- my $self = shift;
- my $content = shift;
-
- my $minified;
- my $jsmin = RT->Config->Get('JSMinPath');
- if ( $jsmin && -x $jsmin ) {
- my $input = $content;
- my ( $output, $error );
-
- # If we're running under fastcgi, STDOUT and STDERR are tied
- # filehandles, which cause IPC::Run3 to flip out. Construct
- # temporary, not-tied replacements for it to see instead.
- my $stdout = IO::Handle->new;
- $stdout->fdopen( 1, 'w' );
- local *STDOUT = $stdout;
- my $stderr = IO::Handle->new;
- $stderr->fdopen( 2, 'w' );
- local *STDERR = $stderr;
-
- local $SIG{'CHLD'} = 'DEFAULT';
- require IPC::Run3;
- IPC::Run3::run3( [$jsmin], \$input, \$output, \$error );
- if ( $? >> 8 ) {
- $RT::Logger->warning("failed to jsmin: $error ");
- }
- else {
- $content = $output;
- $minified = 1;
- }
- }
-
- return $content;
+ my ( $self, $content ) = @_;
+ return JavaScript::Minifier::XS::minify($content);
}
1;
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 17f305b..3c82afc 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -247,6 +247,7 @@ Time::ParseDate
Tree::Simple 1.04
UNIVERSAL::require
XML::RSS 1.05
+JavaScript::Minifier::XS
.
$deps{'MAILGATE'} = [ text_to_hash( << '.') ];
diff --git a/t/web/passthrough-jsmin b/t/web/passthrough-jsmin
deleted file mode 100755
index 41b0196..0000000
--- a/t/web/passthrough-jsmin
+++ /dev/null
@@ -1,4 +0,0 @@
-
-echo "// passthrough-jsmin added this";
-
-exec cat;
diff --git a/t/web/squish.t b/t/web/squish.t
index 9d1c01b..017d9bd 100644
--- a/t/web/squish.t
+++ b/t/web/squish.t
@@ -49,14 +49,11 @@ $m->content_contains('jQuery.noConflict', "found default js content");
RT::Test->stop_server;
-diag "Test with a trivial jsmin which is a pass-through";
-RT->Config->Set( 'JSMinPath' => RT::Test::get_abs_relocatable_dir("passthrough-jsmin"));
( $url, $m ) = RT::Test->started_ok;
$m->login;
($js_link) =
$m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
$m->get_ok( $url . $js_link, 'follow squished js' );
-$m->content_contains( 'passthrough-jsmin added this', "has passthrough-added content" );
$m->content_contains( 'function just_testing', "has not-by-default.js" );
$m->content_contains('jQuery.noConflict', "found default js content");
RT::Test->stop_server;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list