Recently I was working with Assetic for combining and minifying CSS and JS files but ran into an issue with regards to caching the created asset collection. The resulting minified file was being rewritten on every page load which was no good at all. TL;DR: Get the asset collection's "last modified" property and compare it to the written minified file to determine if it needs updating.
Edit Feb 29, This post originally used String Assets to cache the collection's content. It was later found that the string asset caches would conflict due to string assets not having "source" or "target" paths which are a component of the hash. Though an arbitrary source could be set on a string asset to resolve the issue, it's probably better to just use the collection's getLastModified before writing the minified file.
Like you see in my composer. Can I change the "linking" of the files in config. Sorry, read your issue on my phone and missed it. I guess the problem is that the files have been moved in Bootstrap. This should be fixed in and will be part of 2.
I'm having the same problem. Any news? Debug mode is on. Skip to content. Star New issue. This allows a separation between the asset files stored in the application and the files actually presented to the user.
But with Assetic, you can manipulate these assets however you want or load them from anywhere before serving them. These means you can:. Using Assetic provides many advantages over directly serving the files. The files do not need to be stored where they are served from and can be drawn from various sources such as from within a bundle:.
To bring in CSS stylesheets, you can use the same methodologies seen in this entry, except with the stylesheets tag:. The actual rendered tag might simply look like:. This is a key point: once you let Assetic handle your assets, the files are served from a different location. This can cause problems with CSS files that reference images by their relative path. However, this can be fixed by using the cssrewrite filter, which updates paths in CSS files to reflect their new location.
You can also combine several files into one. This helps to reduce the number of HTTP requests, which is great for front end performance. It also allows you to maintain the files more easily by splitting them into manageable parts. This can help with re-usability as you can easily split project-specific files from those which can be used in other applications, but still serve them as a single file:.
In the dev environment, each file is still served individually, so that you can debug problems more easily. However, in the prod environment, this will be rendered as a single script tag.
0コメント