title: sass/scss @import when relative path is symlink
body: <p>We have trouble with <code>@import</code> of scss files from another bundle in symfony2.</p>
  
  <ul>
  <li>The source code (hg repo) lives in <code>/files/...</code> in machine A.</li>
  <li>In devel, apache serves from <code>/var/www/...</code> in machine A, <strong>linking</strong> to <code>/files/...</code> in machine A.</li>
  <li>In production, apache serves from <code>/var/www/...</code> in machine B, with <strong>copies</strong> of the source files inside.</li>
  </ul>
  
  <p>Let's focus on a single <code>Layout.scss</code> file that contains coloring and sizing definitions. These are my paths:</p>
  
  <pre><code># Source code (machine A)
  xavi@bromo$ cd /files/custom_www/guparty/workspace/guparty/Applications/Common/bundles/LayoutBundle/Resources/public/Sass
  xavi@bromo$ ls -l Layout.scss
  -rw-rw-r-- 1 xavi xavi 7528 2013-03-28 12:18 Layout.scss
  
  # Devel (machine A)
  xavi@bromo$ cd /var/www/guparty/workspace/www/frontend/src/gUparty/
  xavi@bromo$ ls -l Common
  lrwxrwxrwx 1 xavi xavi 71 2013-03-28 12:26 Common -&gt; /files/custom_www/guparty/workspace/guparty/Applications/Common/bundles
  
  # Production (machine B)
  ubuntu@ProductionLarge1$ cd /var/www/www.guparty.com/src/gUparty/
  ubuntu@ProductionLarge1$ ls -ld Common/
  drwxr-xr-x 21 www-data www-data 4096 2013-03-28 07:35 Common/
  </code></pre>
  
  <p>Now let's consider the file <code>Test.scss</code> that will include the previous file:</p>
  
  <pre><code># Seen from the source code point of view:
  /files/custom_www/guparty/workspace/guparty/Applications/FrontEnd/bundles/TestingBundle/Resources/public/Sass/Test.scss
  
  # Seen from the devel apache point of view (links to the one above):
  /var/www/guparty/workspace/www/frontend/src/gUparty/FrontEnd/TestingBundle/Resources/public/Sass/Test.scss
  
  # Seen from the production apache point of view:
  /var/www/www.guparty.com/src/gUparty/FrontEnd/TestingBundle/Resources/public/Sass/Test.scss
  </code></pre>
  
  <p>The <code>Test.scss</code> file begins with an <code>@import</code> directive like this one:</p>
  
  <pre><code>@import "../../../../../../../src/gUparty/Common/LayoutBundle/Resources/public/Sass/Layout.scss";
  </code></pre>
  
  <p><strong>The trouble</strong></p>
  
  <p>Seen from the production machine, which contains COPIES of the files, it works like a charm.</p>
  
  <p>Nevertheless, when running from the devel machine, I expected it to work, as the <strong>relative</strong> path is the same. Instead, the operating system <strong>does not show</strong> the linked files to the apache/php, and it appears that the assetic "needs to know" the real path.</p>
  
  <p>In devel, the import fails, and if I change the <code>@import</code> into this, it works fine:</p>
  
  <pre><code>@import "../../../../../../../Applications/Common/bundles/LayoutBundle/Resources/public/Sass/Layout.scss";
  </code></pre>
  
  <p><strong>Solutions that I see, but don't know how to implement</strong></p>
  
  <p>a) Maybe I could configure something so the PHP sees the "relative paths without demapping the symlinks".</p>
  
  <p>b) Maybe I can pass a "variable" from the parameters.ini or similar into the .scss file so I can "discover" if I'm in "linked mode" or "copied mode" and make the <code>@import</code> to use one path or the other.</p>
  
  <p>Any way to implement a or b?
  Any preference between those two strategies?
  Any alternative strategy?</p>
  
  <p>Thanks!
  Xavi.</p>