I am working on integrating Assetic into an application that I am building. The application follows the MVC pattern but does not use any frameworks. Twig is used for templating.
I have read the documentation and have looked at a few helpful blog posts.
The application is structured like this:
- application
- twig_templates
 - js
 - css
 
 - public_html
- js
 - css
 - images
 
 
The twig templates are rendered and then returned by the application, so that is quite straight forward. The js and css folders underneath the application folder would hold the raw javascript and css files.
My plan is that combined and minified js and css files would be stored in the js and css folders under the public_html folder.
Since I don't plan to optimize any images using assetic, they will be placed in the images folder underneath public_html directly.
Now the question:
I understand that by using assetic from twig, combined and minified assets can be exported to my public_html directories:
{% stylesheets '/path/to/sass/main.sass' filter='sass,?yui_css' output='css/all.css' %} <link href="{{ asset_url }}" type="text/css" rel="stylesheet" /> {% endstylesheets %}In this case is the
css/all.cssfile regenerated everytime that template is rendered?To make the application portable (it could be hosted using a virtual host, or perhaps even in a folder) and to ensure things work in a site with routed URLs like
http://site.com/controller/action, does assetic provide anyway "rewrite" URLs for images into absolute ones (i.e.images/a.jpgintohttp://mysite.com/images/a.jpg)?Does assetic work when using nested templates?
parent.twig:<!DOCTYPE html> <html> <head> {% block head %} <link rel="stylesheet" href="mainstyle.css" /> <title>{% block title %}{% endblock %} - My Webpage</title> {% endblock %} </head> <body> </body> </html>child.twig:{% extends "parent.twig" %} {% block title %}Index{% endblock %} {% block head %} {{ parent() }} <link rel="stylesheet" href="childstyle.css" /> {% endblock %}In this case, how can I let assetic know that it should combine
childstyle.cssandmainstyle.cssand serve it as 1 file?