Subject: | Assets should be able to be served by a static server |
Currently asset paths can only be relative to root, and thus only served
by Catalyst. It should be possible to serve static data with
nginx/apache/etc. I'm attaching a patch that allows setting "uri", "dir"
and "path" under "base", such as
uri => 'http://example.com/assets',
dir => '/var/www/htdocs/assets',
path => '/static'
Subject: | Catalyst-Plugin-Assets_baseconfig.patch |
--- Assets.pm.orig 2010-02-18 20:31:02.000000000 +0000
+++ Assets.pm 2010-06-04 09:13:17.000000000 +0000
@@ -78,7 +78,17 @@
# This path will be automatically prepended to includes, so that instead of
# doing ->include("/static/stylesheet.css") you can just do ->include("stylesheet.css")
+
+ base # A hash reference with a "uri" key/value and a "dir" key/value.
+ # For example: { uri => 'http://example.com/assets', dir => '/var/www/htdocs/assets', path => '/static'}
+
+ # A URI::ToDisk object
+
+ # A Path::Resource object
+ # IMPORTANT: Overrides path
+ # Move original path config to base, use of path config should be deprecated
+
output_path # The path to output the results of minification under (if any).
# For example, if output is "built/" (the trailing slash is important), then minified assets will be
@@ -214,7 +224,7 @@
}
my $assets = File::Assets->new(
- base => { uri => $self->uri_for("/"), dir => $self->path_to("root"), path => $path },
+ base => ($config->{base} || { uri => $self->uri_for("/"), dir => $self->path_to("root"), path => $path }),
output_path => $output_path,
%assets,
);