Hello community,
here is the log from the commit of package perl-Mojolicious-Plugin-AssetPack for openSUSE:Factory checked in at 2015-08-27 08:57:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack (Old)
and /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious-Plugin-AssetPack"
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack/perl-Mojolicious-Plugin-AssetPack.changes 2015-08-10 09:16:32.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new/perl-Mojolicious-Plugin-AssetPack.changes 2015-08-27 08:57:57.000000000 +0200
@@ -1,0 +2,32 @@
+Mon Aug 24 08:54:14 UTC 2015 - coolo@suse.com
+
+- updated to 0.61
+ see /usr/share/doc/packages/perl-Mojolicious-Plugin-AssetPack/Changes
+
+ 0.61 2015-08-23T13:34:34+0200
+ - Add include_paths() to Scss preprocessor
+ - Fix using SASS_PATH environment variable when calculating checksum #60
+ - Deprecating asset->preprocessor() in favor of asset->preprocessors->add()
+
+-------------------------------------------------------------------
+Sun Aug 23 09:02:38 UTC 2015 - coolo@suse.com
+
+- updated to 0.60
+ see /usr/share/doc/packages/perl-Mojolicious-Plugin-AssetPack/Changes
+
+ 0.60 2015-08-20T17:21:54+0200
+ - Fix detecting changed sass/scss files in sub directories, with leading underscore
+
+ 0.59 2015-08-20T14:42:25+0200
+ - Cannot look for packed files in "source_paths"
+ - MOJO_ASSETPACK_DEBUG need to be set to "2" for more verbose debug
+
+ 0.58 2015-08-09T14:28:04+0200
+ - Change "source_paths" to return original reference and not a copy
+ - Need to look for packed files in all directories (source_paths+public)
+
+ 0.57 2015-08-09T11:34:21+0200
+ - Add support for "source_paths" (EXPERIMENTAL) #58
+ - Add support for fetching assets using a proxy
+
+-------------------------------------------------------------------
Old:
----
Mojolicious-Plugin-AssetPack-0.56.tar.gz
New:
----
Mojolicious-Plugin-AssetPack-0.61.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojolicious-Plugin-AssetPack.spec ++++++
--- /var/tmp/diff_new_pack.or9Eis/_old 2015-08-27 08:57:57.000000000 +0200
+++ /var/tmp/diff_new_pack.or9Eis/_new 2015-08-27 08:57:57.000000000 +0200
@@ -17,7 +17,7 @@
Name: perl-Mojolicious-Plugin-AssetPack
-Version: 0.56
+Version: 0.61
Release: 0
%define cpan_name Mojolicious-Plugin-AssetPack
Summary: Compress and convert css, less, sass, javascript and coffeescript files
++++++ Mojolicious-Plugin-AssetPack-0.56.tar.gz -> Mojolicious-Plugin-AssetPack-0.61.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/Changes new/Mojolicious-Plugin-AssetPack-0.61/Changes
--- old/Mojolicious-Plugin-AssetPack-0.56/Changes 2015-08-05 10:44:15.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/Changes 2015-08-23 13:34:34.000000000 +0200
@@ -1,5 +1,25 @@
Revision history for perl distribution Mojolicious-Plugin-AssetPack
+0.61 2015-08-23T13:34:34+0200
+ - Add include_paths() to Scss preprocessor
+ - Fix using SASS_PATH environment variable when calculating checksum #60
+ - Deprecating asset->preprocessor() in favor of asset->preprocessors->add()
+
+0.60 2015-08-20T17:21:54+0200
+ - Fix detecting changed sass/scss files in sub directories, with leading underscore
+
+0.59 2015-08-20T14:42:25+0200
+ - Cannot look for packed files in "source_paths"
+ - MOJO_ASSETPACK_DEBUG need to be set to "2" for more verbose debug
+
+0.58 2015-08-09T14:28:04+0200
+ - Change "source_paths" to return original reference and not a copy
+ - Need to look for packed files in all directories (source_paths+public)
+
+0.57 2015-08-09T11:34:21+0200
+ - Add support for "source_paths" (EXPERIMENTAL) #58
+ - Add support for fetching assets using a proxy
+
0.56 2015-08-05T10:44:15+0200
- Add purge() method (EXPERIMENTAL)
- Add support for wildcards in filenames (EXPERIMENTAL) #52
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/MANIFEST new/Mojolicious-Plugin-AssetPack-0.61/MANIFEST
--- old/Mojolicious-Plugin-AssetPack-0.56/MANIFEST 2015-08-05 10:44:15.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/MANIFEST 2015-08-23 13:34:35.000000000 +0200
@@ -32,6 +32,7 @@
t/00-basic.t
t/16-empty-js-file.t
t/20-fail-to-download-asset.t
+t/assets/css/c.css
t/back-compat-min.t
t/bin/coffee
t/chdir.t
@@ -60,6 +61,7 @@
t/online-google-font.t
t/online-jquery.t
t/plugin-with-assets.t
+t/public/anotherdir/subdir/_issue-60.scss
t/public/css/1w.css
t/public/css/2w.css
t/public/css/5w.css
@@ -86,7 +88,10 @@
t/public/js/https___patform_twitter_com_widgets.js
t/public/sass/_included.scss
t/public/sass/a.sass
+t/public/sass/bs-issue-5.scss
t/public/sass/compass.scss
+t/public/sass/issue-60.scss
+t/public/sass/subdir/_issue-5.scss
t/public/sass/x.scss
t/public/sass/y.scss
t/purge.t
@@ -98,6 +103,7 @@
t/scss.t
t/skip-minified.t
t/SomePluginWithAssets.pm
+t/source-paths.t
t/sprites.t
t/twice.t
t/undefined.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/META.json new/Mojolicious-Plugin-AssetPack-0.61/META.json
--- old/Mojolicious-Plugin-AssetPack-0.56/META.json 2015-08-05 10:44:15.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/META.json 2015-08-23 13:34:35.000000000 +0200
@@ -50,5 +50,5 @@
"url" : "https://github.com/jhthorsen/mojolicious-plugin-assetpack.git"
}
},
- "version" : "0.56"
+ "version" : "0.61"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/META.yml new/Mojolicious-Plugin-AssetPack-0.61/META.yml
--- old/Mojolicious-Plugin-AssetPack-0.56/META.yml 2015-08-05 10:44:15.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/META.yml 2015-08-23 13:34:34.000000000 +0200
@@ -27,4 +27,4 @@
bugtracker: https://github.com/jhthorsen/mojolicious-plugin-assetpack/issues
homepage: https://github.com/jhthorsen/mojolicious-plugin-assetpack
repository: https://github.com/jhthorsen/mojolicious-plugin-assetpack.git
-version: '0.56'
+version: '0.61'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/README new/Mojolicious-Plugin-AssetPack-0.61/README
--- old/Mojolicious-Plugin-AssetPack-0.56/README 2015-08-05 10:44:15.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/README 2015-08-23 13:34:34.000000000 +0200
@@ -3,7 +3,7 @@
javascript and coffeescript files
VERSION
- 0.56
+ 0.61
SYNOPSIS
Application
@@ -146,13 +146,9 @@
for mode details.
preprocessor
- $self = $self->preprocessor($name => \%args);
+ DEPRECATED. Use this instead:
- Use this method to manually register a preprocessor.
-
- See "SYNOPSIS" in
- Mojolicious::Plugin::AssetPack::Preprocessor::Browserify for example
- usage.
+ $self->preprocessors->add($extension => $class => \%attrs);
purge
$self = $self->purge({always => $bool});
@@ -162,17 +158,33 @@
"always" default to true if in "development" mode and false otherwise.
- This method is EXPERIMENTAL and can change, be removed at any time.
+ This method is EXPERIMENTAL and can change or be removed at any time.
register
plugin AssetPack => {
- base_url => $str, # default to "/packed"
- minify => $bool, # compress assets
- out_dir => "/path/to/some/directory",
+ base_url => $str, # default to "/packed"
+ minify => $bool, # compress assets
+ proxy => "detect", # autodetect proxy settings
+ out_dir => "/path/to/some/directory",
+ source_paths => [...],
};
Will register the "compress" helper. All arguments are optional.
+ source_paths
+ $self = $self->source_paths($array_ref);
+ $array_ref = $self->source_paths;
+
+ This method returns a list of paths to source files. The default is to
+ return "paths" in Mojolicious::Static from the current application
+ object, but you can specify your own paths.
+
+ See also "Custom source directories" in
+ Mojolicious::Plugin::AssetPack::Manual::Assets for more information.
+
+ This method is EXPERIMENTAL and can change, but will most likely not be
+ removed.
+
COPYRIGHT AND LICENSE
Copyright (C) 2014, Jan Henning Thorsen.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Asset.pm new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Asset.pm
--- old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Asset.pm 2015-08-05 09:30:57.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Asset.pm 2015-08-20 12:42:19.000000000 +0200
@@ -80,8 +80,11 @@
sub save {
my $self = shift;
- if ($self->in_memory or not defined $self->{content}) {
- warn "[ASSETPACK] Skip save of @{[$self->path]}\n" if DEBUG;
+ if ($self->in_memory) {
+ warn "[ASSETPACK] Cannot save in_memory asset @{[$self->path]}\n" if DEBUG == 2;
+ }
+ elsif (not defined $self->{content}) {
+ warn "[ASSETPACK] Cannot save asset without content @{[$self->path]}\n" if DEBUG == 2;
}
else {
warn "[ASSETPACK] Save @{[$self->path]}\n" if DEBUG;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Handler/Http.pm new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Handler/Http.pm
--- old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Handler/Http.pm 2015-07-28 13:15:27.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Handler/Http.pm 2015-08-20 13:10:16.000000000 +0200
@@ -30,12 +30,7 @@
sub asset_for {
my ($self, $url, $assetpack) = @_;
- my $lookup = Mojolicious::Plugin::AssetPack::_name($url);
-
- if (my $asset = $assetpack->_find('packed', qr{^$lookup\.\w+$})) {
- $assetpack->_app->log->debug("Asset $url is fetched") if DEBUG;
- return $asset;
- }
+ my $name = Mojolicious::Plugin::AssetPack::_name($url);
my $tx = $assetpack->_ua->get($url);
my $ct = $tx->res->headers->content_type // 'text/plain';
@@ -47,8 +42,8 @@
$ext = $ext->[0] if ref $ext;
$ext = $tx->req->url->path =~ m!\.(\w+)$! ? $1 : 'txt' if !$ext or $ext eq 'bin';
- $assetpack->_app->log->info("Asset $url was fetched");
- $assetpack->_asset("$lookup.$ext")->content($tx->res->body);
+ $assetpack->_app->log->info("Asset $url was fetched successfully");
+ $assetpack->_asset("$name.$ext")->content($tx->res->body);
}
=head1 COPYRIGHT AND LICENSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Manual/Assets.pod new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Manual/Assets.pod
--- old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Manual/Assets.pod 2015-08-05 10:36:43.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Manual/Assets.pod 2015-08-09 14:35:35.000000000 +0200
@@ -82,6 +82,35 @@
This feature is currently EXPERIMENTAL.
+=head2 Custom source directories
+
+It's possible to make AssetPack look for source files in a different directory
+than in the public directories. This is useful if you want to keep your source
+files outside of the web root.
+
+ plugin AssetPack => {
+ source_paths => [
+ "assets",
+ "/usr/share/assets",
+ @{$app->static->paths},
+ ]
+ };
+
+The code above tells AssetPack to look for assets in the "assets" directory,
+relative to the L, then in the absolute path
+"/usr/share/assets" and fallback to the static directories (web root).
+
+This is also very neat when using L to watch your
+files:
+
+ # Before and after specifying "source_paths"
+ $ moboo -w public/css -w public/js -w public/tags -w public/sass -w lib
+ $ morbo -w assets -w lib
+
+ # This will cause an infinite loop, since public/packed change on
+ # application reload:
+ $ morbo -w public -w lib
+
=head1 NEXT
Now that you know how to define your assets, you can start using them in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Sass.pm new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Sass.pm
--- old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Sass.pm 2015-07-28 13:15:27.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Sass.pm 2015-08-23 10:44:37.000000000 +0200
@@ -33,30 +33,6 @@
? $ENV{ENABLE_LIBSASS_BINDINGS}
: eval 'require CSS::Sass;1';
-=head2 process
-
-This method use "sass" to process C<$text>.
-
-See LMojolicious::Plugin::AssetPack::Preprocessor/process.
-
-=cut
-
-sub process {
- my ($self, $assetpack, $text, $path) = @_;
-
- if (LIBSASS_BINDINGS) {
- $$text = CSS::Sass::sass2scss($$text);
- return $self->SUPER::process($assetpack, $text, $path);
- }
- else {
- my @cmd = ($self->executable, '--stdin', '-I' => dirname $path);
- push @cmd, qw( -t compressed) if $assetpack->minify;
- $self->_run(\@cmd, $text, $text);
- }
-
- return $self;
-}
-
sub _extension {'sass'}
=head1 COPYRIGHT AND LICENSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Scss.pm new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Scss.pm
--- old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Scss.pm 2015-07-28 13:15:27.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Preprocessor/Scss.pm 2015-08-23 13:32:55.000000000 +0200
@@ -25,7 +25,32 @@
You can force using the executable by setting the environment variable
C to a false value.
-=head1 COMPASS
+=head2 SASS_PATH
+
+The environment variable C can be used to instruct this module
+to search for C<@import> files in directories other than relative to the
+the file containing the C<@import> statement.
+
+Note that C need to hold absolute paths to work properly.
+
+Example usage:
+
+ local $ENV{SASS_PATH} = "/some/dir:/usr/share/other/dir";
+ $app->asset("app.css" => "sass/app.scss");
+
+It is also possible to set the L attribute instead of using
+global variables:
+
+ $app->asset->preprocessors->add(scss => Scss => {include_paths => [...]});
+ $app->asset("app.css" => "sass/app.scss");
+
+The final list of directories to search will be:
+
+ 1. dirname $main_sass_file
+ 3. $self->include_paths()
+ 2. split /:/, $ENV{SASS_PATH}
+
+=head2 COMPASS
Compass is an open-source CSS Authoring Framework built on top of L</sass>.
See Lhttp://compass-style.org/ for more information.
@@ -50,16 +75,20 @@
use Mojo::Base 'Mojolicious::Plugin::AssetPack::Preprocessor';
use Mojo::Util qw( slurp md5_sum );
-use File::Basename 'dirname';
+use File::Basename ();
use File::Spec::Functions 'catfile';
use File::Which ();
use File::Which ();
+
+use constant DEBUG => $ENV{MOJO_ASSETPACK_DEBUG} || 0;
use constant LIBSASS_BINDINGS => defined $ENV{ENABLE_LIBSASS_BINDINGS}
? $ENV{ENABLE_LIBSASS_BINDINGS}
: eval 'require CSS::Sass;1';
$ENV{SASS_PATH} ||= '';
+my $IMPORT_RE = qr{ \@import \s+ (["']) (.*?) \1 }x;
+
=head1 ATTRIBUTES
=head2 executable
@@ -68,9 +97,17 @@
Holds the path to the "sass" executable. Default to just "sass".
+=head2 include_paths
+
+ $self = $self->include_paths(\@paths);
+ $paths = $self->include_paths;
+
+Holds optional paths to search for where to find C<@import> files.
+
=cut
has executable => sub { File::Which::which('sass') || 'sass' };
+has include_paths => sub { [] };
=head1 METHODS
@@ -93,15 +130,15 @@
sub checksum {
my ($self, $text, $path) = @_;
- my $ext = $path =~ /\.(s[ac]ss)$/ ? $1 : $self->_extension;
- my $dir = dirname $path;
- my $re = qr{ \@import \s+ (["']) (.*?) \1 }x;
- my @checksum = md5_sum $$text;
+ my $ext = $path =~ /\.(s[ac]ss)$/ ? $1 : $self->_extension;
+ my @include_paths = $self->_include_paths($path);
+ my @checksum = md5_sum $$text;
local $self->{checked} = $self->{checked} || {};
- while ($$text =~ /$re/gs) {
- my $path = $self->_file($dir, $2, $ext) or next;
+ while ($$text =~ /$IMPORT_RE/gs) {
+ my $path = $self->_import_path(\@include_paths, split('/', $2), $ext) or next;
+ warn "[ASSETPACK] Found \@import $path\n" if DEBUG == 2;
$self->{checked}{$path}++ and next;
push @checksum, $self->checksum(\slurp($path), $path);
}
@@ -109,14 +146,6 @@
return Mojo::Util::md5_sum(join '', @checksum);
}
-sub _file {
- my ($self, $dir, $name, $ext) = @_;
- my $path;
- return $path if -r ($path = catfile $dir, "$name.$ext");
- return $path if -r ($path = catfile $dir, "_$name.$ext");
- return;
-}
-
=head2 process
This method use "sass" to process C<$text>.
@@ -127,16 +156,23 @@
sub process {
my ($self, $assetpack, $text, $path) = @_;
+ my @include_paths = $self->_include_paths($path);
my $err;
+ if (DEBUG) { local $" = ':'; warn "[ASSETPACK] SASS_PATH=@include_paths\n" }
+
if (LIBSASS_BINDINGS) {
- my %args = (include_paths => [dirname($path), split /:/, $ENV{SASS_PATH}]);
+ local $ENV{SASS_PATH} = '';
+ my %args = (include_paths => [@include_paths]);
$args{output_style} = CSS::Sass::SASS_STYLE_COMPRESSED() if $assetpack->minify;
+ $$text = CSS::Sass::sass2scss($$text) if $self->_extension eq 'sass';
($$text, $err, my $srcmap) = CSS::Sass::sass_compile($$text, %args);
die $err if $err;
}
else {
- my @cmd = ($self->executable, '--stdin', '--scss', '-I' => dirname $path);
+ local $ENV{SASS_PATH} = join ':', @include_paths;
+ my @cmd = ($self->executable, '--stdin');
+ push @cmd, '--scss' if $self->_extension eq 'scss';
push @cmd, qw( -t compressed) if $assetpack->minify;
push @cmd, qw( --compass ) if !$ENV{MOJO_ASSETPACK_NO_COMPASS} and $$text =~ m!\@import\W+compass\/!;
$self->_run(\@cmd, $text, $text);
@@ -146,7 +182,26 @@
}
sub _extension {'scss'}
-sub _url {'http://sass-lang.com/install'}
+
+sub _import_path {
+ my ($self, $include_paths, @rel) = @_;
+ my ($ext, $name, $path) = (pop @rel, pop @rel);
+
+ for my $p (map { File::Spec->catdir($_, @rel) } @$include_paths) {
+ return $path if -r ($path = catfile $p, "$name.$ext");
+ return $path if -r ($path = catfile $p, "_$name.$ext");
+ }
+
+ if (DEBUG == 2) { local $" = '/'; warn "[ASSETPACK] Not found \@import @rel/$name.$ext\n" }
+ return;
+}
+
+sub _include_paths {
+ my ($self, $path) = @_;
+ return File::Basename::dirname($path), @{$self->include_paths}, split /:/, $ENV{SASS_PATH};
+}
+
+sub _url {'http://sass-lang.com/install'}
=head1 COPYRIGHT AND LICENSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Preprocessors.pm new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Preprocessors.pm
--- old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack/Preprocessors.pm 2015-07-28 13:15:27.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack/Preprocessors.pm 2015-08-23 13:15:25.000000000 +0200
@@ -63,7 +63,7 @@
$$text = "// yikes!\n" if 5 < rand 10;
}
- app->asset->preprocessors->add(js => My::Preprocessor->new);
+ app->asset->preprocessors->add(js => 'My::Preprocessor' => {});
=cut
@@ -105,24 +105,43 @@
=head2 add
$self->add($extension => $object);
-
+ $self->add($extension => $class => \%attrs);
$self->add($extension => sub {
my ($assetpack, $text, $file) = @_;
$$text =~ s/foo/bar/ if $file =~ /baz/ and $assetpack->minify;
});
-Define a preprocessor which is run on a given file extension. These
-preprocessors will be chained. The callbacks will be called in the order they
-where added.
+Define a preprocessor which is run on a given file extension. All the
+preprocessors will be called in the order they are added.
In case of C<$object>, the object need to be able to have the C
method.
+These two are the same:
+
+ use Mojolicious::Plugin::AssetPack::Preprocessor::Scss;
+ my $object = Mojolicious::Plugin::AssetPack::Preprocessor::Scss->new(\%attrs);
+ $self->add(scss => $object);
+ # the above is the same as... (no need to load the package)
+ $self->add(scss => Scss => \%attrs);
+
+A C<$class> without "::" will be prefixed with
+CMojolicious::Plugin::AssetPack::Preprocessor::.
+
=cut
sub add {
my ($self, $extension, $arg) = @_;
+ # create object
+ if (@_ == 4) {
+ my $class = $arg =~ /::/ ? $arg : "Mojolicious::Plugin::AssetPack::Preprocessor::$arg";
+ eval "require $class;1" or die "Could not load $class: $@\n";
+ warn "[ASSETPACK] Adding $class preprocessor for $extension.\n" if DEBUG;
+ my $object = $class->new(pop);
+ return $self->add($extension => $object);
+ }
+
# back compat
if (ref $arg eq 'CODE') {
$arg = Mojolicious::Plugin::AssetPack::Preprocessor->new(processor => $arg);
@@ -219,13 +238,8 @@
my @preprocessors = @{$self->subscribers($extension)};
return @preprocessors if @preprocessors;
-
- if (my $class = $PREPROCESSORS{$extension}) {
- warn "[ASSETPACK] Adding $class preprocessor.\n" if DEBUG;
- eval "require $class;1" or die "Could not load $class: $@\n";
- return $self->add($extension => $class->new);
- }
-
+ my $class = $PREPROCESSORS{$extension};
+ return $self->add($extension => $class => {}) if $class;
return $self->fallback;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack.pm new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack.pm
--- old/Mojolicious-Plugin-AssetPack-0.56/lib/Mojolicious/Plugin/AssetPack.pm 2015-08-05 10:44:15.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/lib/Mojolicious/Plugin/AssetPack.pm 2015-08-23 13:34:34.000000000 +0200
@@ -12,7 +12,7 @@
use constant DEBUG => $ENV{MOJO_ASSETPACK_DEBUG} || 0;
use constant NO_CACHE => $ENV{MOJO_ASSETPACK_NO_CACHE} || 0;
-our $VERSION = '0.56';
+our $VERSION = '0.61';
has base_url => '/packed/';
has minify => 0;
@@ -36,7 +36,11 @@
sub fetch {
my $self = shift;
- $self->_handler('https')->asset_for(shift, $self)->in_memory(!$self->out_dir)->save->path;
+ my $url = Mojo::URL->new(shift);
+ my $asset
+ = $self->_packed("$url") || $self->_handler($url->scheme)->asset_for($url, $self)->in_memory(!$self->out_dir)->save;
+ return $asset if @_; # internal
+ return $asset->path; # documented api
}
sub get {
@@ -51,18 +55,8 @@
sub preprocessor {
my ($self, $name, $args) = @_;
- my $class = $name =~ /::/ ? $name : "Mojolicious::Plugin::AssetPack::Preprocessor::$name";
- my $preprocessor;
-
$args->{extensions} or die "Usage: \$self->preprocessor(\$name => {extensions => [...]})";
- eval "require $class;1" or die "Could not load $class: $@\n";
- $preprocessor = $class->new($args);
-
- for my $ext (@{$args->{extensions}}) {
- warn "[ASSETPACK] Adding $class preprocessor.\n" if DEBUG;
- $self->preprocessors->on($ext => $preprocessor);
- }
-
+ $self->preprocessors->add($_ => $name => $args) for @{$args->{extensions}};
return $self;
}
@@ -96,13 +90,15 @@
return $app->log->debug("AssetPack: Helper $helper() is already registered.");
}
- $self->{assets} = {};
- $self->{processed} = {};
+ $self->{assets} = {};
+ $self->{processed} = {};
+ $self->{source_paths} = $self->_build_source_paths($app, $config);
$self->_app($app);
$self->_ua->server->app($app);
+ $self->_ua->proxy->detect if $config->{proxy};
$self->minify($config->{minify} // $app->mode ne 'development');
- $self->out_dir($self->_build_out_dir($config, $app));
+ $self->out_dir($self->_build_out_dir($app, $config));
$self->base_url($config->{base_url}) if $config->{base_url};
$self->_reloader($app, $config->{reloader}) if $config->{reloader};
@@ -121,6 +117,19 @@
);
}
+sub source_paths {
+ my $self = shift;
+ my $app = $self->_app;
+
+ if (@_) {
+ $self->{source_paths} = shift;
+ return $self;
+ }
+ else {
+ return $self->{source_paths} || return $app->static->paths;
+ }
+}
+
sub _asset {
my ($self, $name) = @_;
my $asset = $self->{asset}{$name} ||= Mojolicious::Plugin::AssetPack::Asset->new;
@@ -155,7 +164,7 @@
}
sub _build_out_dir {
- my ($self, $config, $app) = @_;
+ my ($self, $app, $config) = @_;
my $out_dir = $config->{out_dir};
if ($out_dir) {
@@ -174,6 +183,13 @@
return $out_dir // '';
}
+sub _build_source_paths {
+ my ($self, $app, $config) = @_;
+
+ return undef unless my $paths = $config->{source_paths};
+ return [map { -d $_ ? Cwd::abs_path($_) : $app->home->rel_file($_) } @$paths];
+}
+
sub _expand_wildcards {
my $self = shift;
my (@files, %seen);
@@ -183,7 +199,7 @@
my @rel = split '/', $file;
my $glob = pop @rel;
- for my $path (map { File::Spec->catdir($_, @rel) } @{$self->_app->static->paths}) {
+ for my $path (map { File::Spec->catdir($_, @rel) } @{$self->source_paths}) {
my $cwd = Mojolicious::Plugin::AssetPack::Preprocessors::CWD->new($path);
push @files, grep { !$seen{$_} } map { join '/', @rel, $_ } sort glob $glob;
}
@@ -197,24 +213,6 @@
return @files;
}
-sub _find {
- my $needle = pop;
- my $self = shift;
- my @path = @_;
-
- # avoid matching .swp files
- $needle = qr{^$needle$} unless ref $needle;
-
- for my $path (map { File::Spec->catdir($_, @path) } @{$self->_app->static->paths}) {
- opendir my $DH, $path or next;
- for (readdir $DH) {
- /$needle/ and return $self->_asset($_)->path(Cwd::abs_path(File::Spec->catfile($path, $_)))->in_memory(0);
- }
- }
-
- return undef;
-}
-
sub _handler {
my ($self, $moniker) = @_;
$self->{handler}{$moniker} ||= do {
@@ -268,26 +266,39 @@
}
}
+sub _packed {
+ my $self = shift;
+ my $needle = ref $_[0] ? shift : _name(shift);
+
+ for my $path (map { File::Spec->catdir($_, 'packed') } @{$self->_app->static->paths}) {
+ opendir my $DH, $path or next;
+ for (readdir $DH) {
+ next unless /$needle/;
+ $path = Cwd::abs_path(File::Spec->catfile($path, $_));
+ $self->_app->log->debug("Using existing asset $path") if DEBUG;
+ return $self->_asset($_)->path($path)->in_memory(0);
+ }
+ }
+
+ return undef;
+}
+
sub _process {
my ($self, $moniker, @sources) = @_;
my ($name, $ext) = (_name($moniker), _ext($moniker));
- my ($asset, $file, $re, @checksum);
+ my ($asset, $file, @checksum);
@sources = map {
- my $asset = $self->_source_for_url($_);
- push @checksum, $self->preprocessors->checksum(_ext($_), \$asset->slurp, $asset->path);
- $asset;
+ my $source = $self->_source_for_url($_);
+ push @checksum, $self->preprocessors->checksum(_ext($_), \$source->slurp, $source->path);
+ $source;
} @sources;
@checksum = (Mojo::Util::md5_sum(join '', @checksum)) if @checksum > 1;
- $file = $self->minify ? "$name-$checksum[0].min.$ext" : "$name-$checksum[0].$ext";
- $re = $self->minify ? qr{^$name-$checksum[0](\.min)?\.$ext$} : qr{^$name-$checksum[0]\.$ext$};
-
- if ($asset = $self->_find('packed', $re)) {
- $self->_app->log->debug("Using existing asset for $moniker") if DEBUG;
- return $asset;
- }
+ $asset = $self->_packed($self->minify ? qr{^$name-$checksum[0](\.min)?\.$ext$} : qr{^$name-$checksum[0]\.$ext$});
+ return $asset if $asset;
+ $file = $self->minify ? "$name-$checksum[0].min.$ext" : "$name-$checksum[0].$ext";
$asset = $self->{asset}{$file} = Mojolicious::Plugin::AssetPack::Asset->new;
$asset->in_memory(1)->path(File::Spec->catfile($self->out_dir, $file));
@@ -341,18 +352,20 @@
}
sub _source_for_url {
- my $self = shift;
- my $url = Mojo::URL->new(shift);
- my $asset;
+ my ($self, $url) = @_;
- if (my $scheme = $url->scheme) {
- $asset = $self->_handler($scheme)->asset_for($url, $self)->in_memory(!$self->out_dir)->save;
+ if (my $scheme = Mojo::URL->new($url)->scheme) {
+ return $self->fetch($url, 'internal');
}
- else {
- $asset = $self->_find(split '/', $url) || $self->_handler('https')->asset_for($url, $self);
+
+ my @look_in = (@{$self->source_paths}, @{$self->_app->static->paths});
+ my @path = split '/', $url;
+
+ for my $path (map { Cwd::abs_path(File::Spec->catfile($_, @path)) } @look_in) {
+ return $self->_asset($_)->path($path)->in_memory(0) if $path and -r $path;
}
- return $asset;
+ return $self->_handler('https')->asset_for($url, $self);
}
sub _unlink_packed {
@@ -380,7 +393,7 @@
=head1 VERSION
-0.56
+0.61
=head1 SYNOPSIS
@@ -559,12 +572,9 @@
=head2 preprocessor
- $self = $self->preprocessor($name => \%args);
+DEPRECATED. Use this instead:
-Use this method to manually register a preprocessor.
-
-See LMojolicious::Plugin::AssetPack::Preprocessor::Browserify/SYNOPSIS
-for example usage.
+ $self->preprocessors->add($extension => $class => \%attrs);
=head2 purge
@@ -576,18 +586,34 @@
C<always> default to true if in "development" L and
false otherwise.
-This method is EXPERIMENTAL and can change, be removed at any time.
+This method is EXPERIMENTAL and can change or be removed at any time.
=head2 register
plugin AssetPack => {
- base_url => $str, # default to "/packed"
- minify => $bool, # compress assets
- out_dir => "/path/to/some/directory",
+ base_url => $str, # default to "/packed"
+ minify => $bool, # compress assets
+ proxy => "detect", # autodetect proxy settings
+ out_dir => "/path/to/some/directory",
+ source_paths => [...],
};
Will register the C<compress> helper. All L are optional.
+=head2 source_paths
+
+ $self = $self->source_paths($array_ref);
+ $array_ref = $self->source_paths;
+
+This method returns a list of paths to source files. The default is to return
+LMojolicious::Static/paths from the current application object, but you can
+specify your own paths.
+
+See also L
+for more information.
+
+This method is EXPERIMENTAL and can change, but will most likely not be removed.
+
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2014, Jan Henning Thorsen.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/t/Helper.pm new/Mojolicious-Plugin-AssetPack-0.61/t/Helper.pm
--- old/Mojolicious-Plugin-AssetPack-0.56/t/Helper.pm 2015-07-28 13:15:27.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/t/Helper.pm 2015-08-09 11:14:27.000000000 +0200
@@ -12,6 +12,7 @@
my $t = Test::Mojo->new(Mojolicious->new);
$args->{log} ||= [];
+ $t->app->home->parse(Cwd::abs_path(File::Spec->catdir(dirname $0)));
$t->app->log->on(message => sub { push @{$args->{log}}, $_[2] });
$t->app->static->paths([Cwd::abs_path(File::Spec->catdir(dirname($0), 'public'))]);
$t->app->plugin(AssetPack => $args || {});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/t/assets/css/c.css new/Mojolicious-Plugin-AssetPack-0.61/t/assets/css/c.css
--- old/Mojolicious-Plugin-AssetPack-0.56/t/assets/css/c.css 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-0.61/t/assets/css/c.css 2015-08-09 11:14:27.000000000 +0200
@@ -0,0 +1,3 @@
+body {
+ background: #c1c1c1;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/t/dynamic-assets.t new/Mojolicious-Plugin-AssetPack-0.61/t/dynamic-assets.t
--- old/Mojolicious-Plugin-AssetPack-0.56/t/dynamic-assets.t 2015-07-28 13:15:27.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/t/dynamic-assets.t 2015-08-20 13:31:58.000000000 +0200
@@ -6,8 +6,8 @@
my $t = Test::Mojo->new(t::Dynamic->new);
-$t->get_ok('/test.css')->status_is(200)->content_type_is('text/css')->content_is(q!body { background-color: blue }!);
-$t->get_ok('/inline')->status_is(200)->element_exists('style')->text_like('style', qr/body{background-color:blue}/);
-$t->get_ok('/referred')->status_is(200)->text_like('html head style', qr{background-color:\s*blue});
+$t->get_ok('/test.css')->status_is(200)->content_type_is('text/css')->content_is('body { background-color: blue }');
+$t->get_ok('/inline')->status_is(200)->element_exists('style')->text_like('style', qr/body\{background-color:blue\}/);
+$t->get_ok('/referred')->status_is(200)->text_like('html head style', qr/background-color:\s*blue/);
done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/t/example-fetch.t new/Mojolicious-Plugin-AssetPack-0.61/t/example-fetch.t
--- old/Mojolicious-Plugin-AssetPack-0.56/t/example-fetch.t 2015-07-28 13:15:27.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/t/example-fetch.t 2015-08-20 13:22:52.000000000 +0200
@@ -30,10 +30,7 @@
$t->get_ok($t->tx->res->dom->at('link')->{href})->status_is(200)
->content_like(
qr{url\('http___cdnjs_cloudflare_com_ajax_libs_font-awesome_4_1_0__fonts_fontawesome-webfont_eot_v_4_1_0\.eot'\)},
- 'eot')->content_like(
- qr{url\('http___cdnjs_cloudflare_com_ajax_libs_font-awesome_4_1_0__fonts_fontawesome-webfont_eot__iefix_v_4_1_0\.eot'\)},
- 'iefix'
- )
+ 'eot')
->content_like(
qr{url\('http___cdnjs_cloudflare_com_ajax_libs_font-awesome_4_1_0__fonts_fontawesome-webfont_woff_v_4_1_0\.woff'\)},
'woff')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/t/public/anotherdir/subdir/_issue-60.scss new/Mojolicious-Plugin-AssetPack-0.61/t/public/anotherdir/subdir/_issue-60.scss
--- old/Mojolicious-Plugin-AssetPack-0.56/t/public/anotherdir/subdir/_issue-60.scss 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-0.61/t/public/anotherdir/subdir/_issue-60.scss 2015-08-23 13:33:32.000000000 +0200
@@ -0,0 +1,2 @@
+// should also be detected when changed
+body{color: #ccc;}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/t/public/sass/bs-issue-5.scss new/Mojolicious-Plugin-AssetPack-0.61/t/public/sass/bs-issue-5.scss
--- old/Mojolicious-Plugin-AssetPack-0.56/t/public/sass/bs-issue-5.scss 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-0.61/t/public/sass/bs-issue-5.scss 2015-08-20 17:06:03.000000000 +0200
@@ -0,0 +1 @@
+@import "subdir/issue-5";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/t/public/sass/issue-60.scss new/Mojolicious-Plugin-AssetPack-0.61/t/public/sass/issue-60.scss
--- old/Mojolicious-Plugin-AssetPack-0.56/t/public/sass/issue-60.scss 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-0.61/t/public/sass/issue-60.scss 2015-08-23 10:01:47.000000000 +0200
@@ -0,0 +1 @@
+@import "subdir/issue-60";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/t/public/sass/subdir/_issue-5.scss new/Mojolicious-Plugin-AssetPack-0.61/t/public/sass/subdir/_issue-5.scss
--- old/Mojolicious-Plugin-AssetPack-0.56/t/public/sass/subdir/_issue-5.scss 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-0.61/t/public/sass/subdir/_issue-5.scss 2015-08-23 13:33:31.000000000 +0200
@@ -0,0 +1,2 @@
+// should also be detected when changed
+body{color: #b00;}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/t/scss.t new/Mojolicious-Plugin-AssetPack-0.61/t/scss.t
--- old/Mojolicious-Plugin-AssetPack-0.56/t/scss.t 2015-07-28 13:15:27.000000000 +0200
+++ new/Mojolicious-Plugin-AssetPack-0.61/t/scss.t 2015-08-23 13:32:09.000000000 +0200
@@ -39,8 +39,62 @@
is(Mojolicious::Plugin::AssetPack::Preprocessor::Scss->_url, 'http://sass-lang.com/install', '_url');
+{
+ # https://github.com/jhthorsen/mojolicious-plugin-bootstrap3/issues/5
+ my $scss_file = File::Spec->catfile(qw( t public sass subdir _issue-5.scss ));
+ my $app = t::Helper->t->app;
+ $app->asset('change.css' => '/sass/bs-issue-5.scss');
+ like + ($app->asset->get('change.css', {assets => 1}))[0]->slurp, qr{\#b00}, 'original';
+
+ modify($scss_file, sub {s!b00!00b!});
+ $app = t::Helper->t->app;
+ $app->asset('change.css' => '/sass/bs-issue-5.scss');
+ like + ($app->asset->get('change.css', {assets => 1}))[0]->slurp, qr{\#00b}, 'updated';
+
+ modify($scss_file, sub {s!00b!b00!}); # reset
+}
+
+{
+ # https://github.com/jhthorsen/mojolicious-plugin-assetpack/pull/60
+
+ local $ENV{SASS_PATH} = join(':',
+ '/will/not/find/anything/here',
+ File::Spec->catdir(File::Spec->rel2abs(File::Spec->curdir), qw( t public anotherdir )),
+ '/other/directory');
+
+ # SASS_PATH
+ my $app = t::Helper->t->app;
+ my $scss_file = File::Spec->catfile(qw( t public anotherdir subdir _issue-60.scss ));
+ modify($scss_file, sub {s!ccc!ddd!});
+ $app->asset('change.css' => '/sass/issue-60.scss');
+ like + ($app->asset->get('change.css', {assets => 1}))[0]->slurp, qr{\#ddd},
+ 'SASS_PATH is searched after dirname($path)';
+ is int(split ':', $ENV{SASS_PATH}), 3, 'SASS_PATH was localized';
+
+ # include_paths()
+ $app = t::Helper->t->app;
+ modify($scss_file, sub {s!ddd!333!});
+ $app->asset->preprocessors->add(scss => Scss => {include_paths => [split /:/, $ENV{SASS_PATH}]});
+ local $ENV{SASS_PATH} = '';
+ $app->asset('change.css' => '/sass/issue-60.scss');
+ like + ($app->asset->get('change.css', {assets => 1}))[0]->slurp, qr{\#333},
+ 'include_paths() is searched after dirname($path)';
+ is int(split ':', $ENV{SASS_PATH}), 0, 'SASS_PATH was localized';
+
+ # reset
+ modify($scss_file, sub {s!333!ccc!});
+}
+
done_testing;
+sub modify {
+ use Mojo::Util qw( slurp spurt );
+ my ($scss_file, $cb) = @_;
+ local $_ = slurp $scss_file;
+ $cb->();
+ spurt $_ => $scss_file;
+}
+
__DATA__
@@ test1.html.ep
%= asset 'scss.css'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-0.56/t/source-paths.t new/Mojolicious-Plugin-AssetPack-0.61/t/source-paths.t
--- old/Mojolicious-Plugin-AssetPack-0.56/t/source-paths.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Mojolicious-Plugin-AssetPack-0.61/t/source-paths.t 2015-08-09 14:24:32.000000000 +0200
@@ -0,0 +1,31 @@
+use t::Helper;
+
+my @mtime;
+
+{
+ my $t = t::Helper->t({source_paths => ['assets']});
+ $t->app->asset('app.css' => '/css/c.css');
+ $t->get_ok('/test1')->status_is(200)->content_like(qr{c1c1c1});
+ @mtime = mtime($t);
+ $mtime[1] -= 2;
+ utime $mtime[1], reverse @mtime;
+}
+
+{
+ my $t = t::Helper->t({source_paths => [Cwd::abs_path(File::Spec->catdir(File::Basename::dirname($0), 'assets'))]});
+ $t->app->asset('app.css' => '/css/c.css');
+ $t->get_ok('/test1')->status_is(200)->content_like(qr{c1c1c1});
+
+ # make sure we find packed assets in public directories
+ is_deeply [mtime($t)], \@mtime, 'same packed file';
+}
+
+done_testing;
+
+sub mtime {
+ map { ($_->path, (stat $_->path)[9]) } $_[0]->app->asset->get('app.css', {assets => 1});
+}
+
+__DATA__
+@@ test1.html.ep
+%= asset 'app.css', {inline => 1}