[Jifty-commit] jifty branch, master, updated. 1.10518-81-g36e1352
Jifty commits
jifty-commit at lists.jifty.org
Mon May 7 14:26:35 EDT 2012
The branch, master has been updated
via 36e13529af99385995b051b02f48161ab310b3e6 (commit)
from 16108cd535d33dd9ae01506d73555c3ef7b3260f (commit)
Summary of changes:
lib/Jifty/Plugin/CompressedCSSandJS.pm | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 36e13529af99385995b051b02f48161ab310b3e6
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon May 7 11:26:17 2012 -0700
Add CDN support to CompressedCSSandJS
diff --git a/lib/Jifty/Plugin/CompressedCSSandJS.pm b/lib/Jifty/Plugin/CompressedCSSandJS.pm
index 8000cba..ac34cd5 100644
--- a/lib/Jifty/Plugin/CompressedCSSandJS.pm
+++ b/lib/Jifty/Plugin/CompressedCSSandJS.pm
@@ -24,6 +24,7 @@ Jifty::Plugin::CompressedCSSandJS - Compression of CSS and javascript files
js: 1
css: 1
jsmin: /path/to/jsmin
+ cdn_url_prefix: https://app.ssl.a.fastly.net
skipped_js:
- complex.js
@@ -45,7 +46,7 @@ skipped_js is a list of js that you don't want to compress for some reason.
=cut
-__PACKAGE__->mk_accessors(qw(css js jsmin skipped_js external_publish));
+__PACKAGE__->mk_accessors(qw(css js jsmin skipped_js cdn_url_prefix external_publish));
=head2 init
@@ -64,6 +65,7 @@ sub init {
$self->js( $opt{js} );
$self->jsmin( $opt{jsmin} );
$self->external_publish( $opt{external_publish} );
+ $self->cdn_url_prefix($opt{cdn_url_prefix} ||'');
if ($self->external_publish and not Jifty::CAS->backend("ccjs")->durable) {
$self->log->warn("External publishing does not work with non-durable CAS stores; disabling");
$self->external_publish(0);
@@ -114,6 +116,7 @@ sub _include_javascript {
$self->generate_javascript unless $self->external_publish;
Jifty->web->out(
qq[<script type="text/javascript" src="]
+ . $self->cdn_url_prefix()
. Jifty::CAS->uri("ccjs","js-all")
. qq[.js"></script>] );
@@ -121,7 +124,7 @@ sub _include_javascript {
if ( $self->skipped_js ) {
for my $file ( @{ $self->skipped_js } ) {
Jifty->web->out(
- qq{<script type="text/javascript" src="/static/js/$file" /> });
+ qq{<script type="text/javascript" src="'}.$self->cdn_url_prefix.qq{ '/static/js/$file" /> });
}
}
return 0;
@@ -132,6 +135,7 @@ sub _include_css {
$self->generate_css unless $self->external_publish;
Jifty->web->out(
qq{<link rel="stylesheet" type="text/css" href="}
+ . $self->cdn_url_prefix()
. Jifty::CAS->uri('ccjs', 'css-all').'.css" />');
return 0;
}
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list