Created
          July 21, 2013 04:58 
        
      - 
      
- 
        Save serapheem/6047537 to your computer and use it in GitHub Desktop. 
    Symfony2 - Using Assetic for asset management
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Twig: | |
| {% javascripts '@AcmeFooBundle/Resources/public/js/*' %} | |
| <script type="text/javascript" src="{{ asset_url }}"></script> | |
| {% endjavascripts %} | |
| {% stylesheets '@AcmeFooBundle/Resources/public/css/*' %} | |
| <link rel="stylesheet" href="{{ asset_url }}" /> | |
| {% endstylesheets %} | |
| PHP: | |
| <?php foreach ($view['assetic']->javascripts( | |
| array('@AcmeFooBundle/Resources/public/js/*')) as $url): ?> | |
| <script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script> | |
| <?php endforeach; ?> | |
| <?php foreach ($view['assetic']->stylesheets( | |
| array('@AcmeFooBundle/Resources/public/css/*')) as $url): ?> | |
| <link rel="stylesheet" href="<?php echo $view->escape($url) ?>" /> | |
| <?php endforeach; ?> | |
| Controlling the URL used for dump: | |
| Twig: | |
| {% javascripts '@AcmeFooBundle/Resources/public/js/*' output='js/compiled/main.js' %} | |
| <script src="{{ asset_url }}"></script> | |
| {% endjavascripts %} | |
| PHP: | |
| <?php foreach ($view['assetic']->javascripts( | |
| array('@AcmeFooBundle/Resources/public/js/*'), | |
| array(), | |
| array('output' => 'js/compiled/main.js') | |
| ) as $url): ?> | |
| <script src="<?php echo $view->escape($url) ?>"></script> | |
| <?php endforeach; ?> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment