title: Sass transformation: each file preprocessing
body: <h2>Problem</h2>
  
  <p>We are using System.Web.Optimization bundling and BundleTransformer for SASS/SCSS. Is it possible to call some preprocessing before each sass file? Not only before files included in bundle, but before files imported using @import too.</p>
  
  <p>If you want to do some preprocessing before each file in bundle you can add some custom IItemTransform or IBundleTransform, but imagine this:</p>
  
  <pre><code>Main.scss:
      @import '_mixin';
      some styles
  _mixin.scss:
      some mixins
  </code></pre>
  
  <p>Main.scss is included in bundle and will be preprocessed, but _mixin.scss is not included in bundle, so scss compiler will get raw file from disk without any preprocessing.</p>
  
  <p>Any hook into compiling process? Or some other way?</p>
  
  <h2>Why do we need this?</h2>
  
  <p>Our common static files are located in Core project. This core project static is included in other projects as virtual directory in IIS (in debug) or copied (in release). With this solution we can use '/SharedStatic/..' in any project and it's resolved always: as virtual directory in debug and as usual path in release.</p>
  
  <p>So right @import to core project must be like that (works with BundleTransformer):</p>
  
  <pre><code>@import '~/SharedStatic/Styles/_mixin.scss'
  </code></pre>
  
  <p>But VS intellisense (or R# intellisense) and WebEssentials intellisense don't understand <strong>'~'</strong> imports at compile time. Intellisense understands only this:</p>
  
  <pre><code>@import '../../../../CoreProject/Static/_mixin.scss'
  </code></pre>
  
  <p>So idea is to preprocess scss files while bundling and fix imports from <strong>'../../..'</strong> to <strong>'~/'</strong>.</p>