Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have <strong>2 options</strong> when dealing with assets. The reason you do not see your assets physically in your computer is because you chose Option 1.</p> <hr> <h2><strong>Option 1: SYMFONY CAN PROCESS THE FILES DYNAMICALLY FOR YOU</strong></h2> <p>That means that each asset path generated in the dev environment is handled dynamically by Symfony. Therefore, Assetic generates paths to CSS and JavaScript files that don't physically exist on your computer. This is an internal Symfony controller that opens the files and serves back the content for you.</p> <p><strong><em>Advantages:</em></strong> - Changes made on your assets take immediate effect - This is great in dev mode as Symfony generates the files dynamically for you</p> <p><strong><em>Disadvantages:</em></strong> - This is not possible in prod mode as rendering each asset dynamically would be too slow - The assets won't be directly accessible on your computer (which is why you cannot find the file) - Can be quite slow if you are using a lot of filters, etc...</p> <p>To do this in dev mode, just edit assetic config in config_dev.yml:</p> <pre><code>assetic: use_controller: true </code></pre> <hr> <h2><strong>Option 2: DUMPING ASSET FILES</strong></h2> <p>If you don't want to handle the assets dynamically, you can dump your assets manually, meaning actually writing your assets phisically on your computer.</p> <p><strong><em>Advantages:</em></strong> - No need for Symfony to generate the files dynamically so this will run a lot faster - Therefore, this is perfect in prod mode - The files are physically accessible in the web/ directory (or wherever you chose to output them)</p> <p><strong><em>Disadvantages:</em></strong> - You either need to dump the assets each time you change something..or you can dump the assets with the --watch command, which can potentially be a bit annoying if you are working in dev mode.</p> <p>To do this:</p> <p><strong>Set use_controller to false (config_dev.yml):</strong></p> <pre><code>assetic: debug: %kernel.debug% use_controller: false </code></pre> <p>You can even choose where to read and output your assets if necessary </p> <pre><code> assetic: read_from: %kernel.root_dir%/Resources/views/ write_to: %kernel.root_dir%/../web/thefolderyouwant/ </code></pre> <p>The ouput now starts from your <em>write_to</em> config in assetic</p> <pre><code>{% stylesheets '@FooBundle/Resources/public/css/main.css' output='css/main.css' %} &lt;link rel="stylesheet" href="{{ asset_url }}" /&gt; {% endstylesheets %} </code></pre> <p>You will have a <a href="https://stackoverflow.com/questions/7861030/symfony2-assetic-route-and-resource-errors">resource error</a> if you continue, so comment out or delete these assetic route in config_dev.yml:</p> <pre><code>_assetic: resource: . type: assetic </code></pre> <p>Finally, you can generate the assets automatically, so that the changes that you make take immediate effect:</p> <pre><code>php app/console assetic:dump --watch </code></pre> <p>In that case, the file should now be available:</p> <p><em>/web/thefolderyouwant/css/main.css</em></p> <p>See the Cookbook for more info: <a href="http://symfony.com/doc/current/cookbook/assetic/asset_management.html" rel="nofollow noreferrer">How to use Assetic for Asset Management?</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload