Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I solved this using htaccess:</p> <p>My assets are stored in src/Datacode/BudgetBundle/Resources/public/(css|img|js) and the assetic output parameter is set to write to: bundles/datacodebudget/css/styles.css (in web directory)</p> <p>In my css i use the relative path ../ to reference images.</p> <p>Here is the .htaccess rule:</p> <pre><code># Make image path work on dev # i.e. /app_dev.php/bundles/datacodebudget/img/glyphicons-halflings-white.png rewrites to /bundles/datacodebudget/img/glyphicons-halflings-white.png RewriteRule ^app_dev\.php/(.*)/(.*)/img/(.*)$ /$1/$2/img/$3 [L] </code></pre> <p>My css is loaded as follows:</p> <pre><code>{% stylesheets '@DatacodeBudgetBundle/Resources/public/css/bootstrap.css' '@DatacodeBudgetBundle/Resources/public/css/bootstrap-responsive.css' '@DatacodeBudgetBundle/Resources/public/css/styles.css' '@DatacodeBudgetBundle/Resources/public/css/chosen.css' output="bundles/datacodebudget/css/styles.css" %} &lt;link href="{{ asset_url }}" rel="stylesheet" type="text/css" /&gt; {% endstylesheets %} </code></pre> <p>In my config.yml file i have:</p> <pre><code>assetic: use_controller: true </code></pre> <p>Which (without the htaccess rewrite) causes the images not to load since the relative path for the image is at app_dev.php/bundles/datacodebudget/img/someimage.jpg. Using the cssrewrite filter doesn't work either because then it rewrites ../img to ../../../../Resources/public/img/ which resolves to Resources/public/img.</p> <p>By using the htaccess method the images load fine and I only need to run assetic:dump / assets:install when i add new images or want to push changes to production.</p>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    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