Closed koseduhemak closed 5 years ago
Using this config I was able to get the files to show up at http://myhost.com/myfile.js
and it was stored correctly in the public folder but in the main folder (which in my opinion is bad).
What I might suggest instead of the paths
resolver is to use an alias
resolver. Just to keep naming collisions from happening as you grow.
'asset_manager' => array(
'filter-config' => [
'jpegtran' => [
'copy' => JpegtranFilter::COPY_NONE,
'optimize' => true,
'progressive' => true
]
],
'resolver_configs' => array(
'aliases' => array(
'module/app/' => __DIR__ . '/../assets',
),
),
'view_helper' => array(
//'cache' => \Assetic\Cache\FilesystemCache::class, // You will need to require the factory used for the cache yourself.
'append_timestamp' => true, // optional, if false never append a query param
'query_string' => '_ver', // optional
),
'caching' => array(
'default' => array(
'cache' => \AssetManager\Cache\FilePathCache::class, // Apc, FilePath, FileSystem etc.
'options' => array(
'dir' => 'public', // path/to/cache
),
),
),
'filters' => array(
'image/jpeg' => [
[
'service' => \Assetic\Filter\JpegtranFilter::class
]
],
'js' => array(
array(
'filter' => \Base\AssetFilter\JsMinFilter::class,
),
),
'css' => [
[
'filter' => \Base\AssetFilter\CssMinFilter::class
]
],
),
),
This will get your file to resolve at http://myhost.com/module/app/myfile.js
instead and get cached to pubic/module/app/myfile.js
Give that a try and see if it behaves more to your liking.
Also don't forget to make sure the webserver has write permissions to the public folder. I'm sure you already checked that... but just making sure.
Thank you sir. I will try your suggestions and use an alias resolver for each of my modules (to make sure naming conflicts do not happen).
Hello,
I was wondering if Assetmanager can cache and apply filters on directly used URIs. F. e. I have an css file which contains a reference to an image (background-image). The image gets served and displayed, but it is not processed / cached via my configured filters. The image was placed in "module/Application/assets/images/404.jpg".
If I use the view helper $this->asset(path-to-image); in an src tag f. e. everything works fine.
Config:
Any help would be appreciated.