This project has moved and is read-only. For the latest updates, please go here.

UrlRewritingCssPostProcessor

Oct 14, 2014 at 9:14 PM
Edited Oct 14, 2014 at 9:14 PM
The documentation states (emphasis mine):
BundleTransformer.Autoprefixer contains one postprocessor-adapter for postprocessing of CSS-code - AutoprefixCssPostProcessor
And all the documentation reflects the AutoprefixCssPostProcessor. However, I do see the UrlRewritingCssPostProcessor class in the BundleTransformer.Core.PostProcessors namespace. It appears to be used for rewriting relative paths in less files to absolute. When it appeared to do nothing, I traced the logic of the class. It seems that maybe I need an IRelativePathResolver in order to use this.

Can you advise?

Relevant config:
<bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
    <core>
        <css defaultMinifier="NullMinifier" usePreMinifiedFiles="true" defaultPostProcessors="UrlRewritingCssPostProcessor">
            ...
            <postProcessors>
                <add name="UrlRewritingCssPostProcessor" type="BundleTransformer.Core.PostProcessors.UrlRewritingCssPostProcessor, BundleTransformer.Core" useInDebugMode="true" />
                </postProcessors>
    </core>
    ...
</bundleTransformer>
Oct 15, 2014 at 8:32 AM
Hello, Willeyams!
The documentation states (emphasis mine):
BundleTransformer.Autoprefixer contains one postprocessor-adapter for postprocessing of CSS-code - AutoprefixCssPostProcessor
All right: BundleTransformer.Autoprefixer contains one postprocessor-adapter - AutoprefixCssPostProcessor, and BundleTransformer.Core contains one postprocessor-adapter - UrlRewritingCssPostProcessor.
And all the documentation reflects the AutoprefixCssPostProcessor. However, I do see the UrlRewritingCssPostProcessor class in the BundleTransformer.Core.PostProcessors namespace.
You just don't carefully read the section “Postprocessors”:
… BundleTransformer.Core contains the UrlRewritingCssPostProcessor class that responsible for transformation of relative paths to absolute in CSS-assets. If in the \configuration\bundleTransformer\core\css configuration element not set the defaultPostProcessors attribute, then an instance of the UrlRewritingCssPostProcessor class will added to list of active processors by default. If you have previously used the disableNativeCssRelativePathTransformation attribute to disable native transformation of relative paths to absolute in CSS-assets, then now you need for this purpose use the defaultPostProcessors attribute (set an empty value or remove UrlRewritingCssPostProcessor from a comma-separated list).
UrlRewritingCssPostProcessor is contained in the core, and therefore it is not in the list of postprocessor-modules.
When it appeared to do nothing, I traced the logic of the class.
UrlRewritingCssPostProcessor appeared in the Bundle Transformer 1.9.0. Mention of it is even on the home page of this project. UrlRewritingCssPostProcessor is an implementation of the old class CssRelativePathFilter (contained in the Bundle Transformer since the first version) as postprocessor.
It seems that maybe I need an IRelativePathResolver in order to use this.
Frankly I do not understand what you mean. IRelativePathResolver is already used in UrlRewritingCssPostProcessor class. In addition, IRelativePathResolver interface is also used in the following modules: BundleTransformer.Less, BundleTransformer.SassAndScss and BundleTransformer.TypeScript.