Skip to content

Autoprefixer

Taritsyn edited this page Aug 14, 2024 · 54 revisions

BundleTransformer.Autoprefixer contains one postprocessor-adapter for postprocessing of CSS code - AutoprefixCssPostProcessor. This adapter makes actualization of vendor prefixes in CSS code by using the Autoprefixer Host for .NET version 3.0.36 (supports the Andrey Sitnik's Autoprefixer version 10.4.20.0).

As a JS engine is used the JavaScript Engine Switcher library. For correct working of this module, you need to install one of the following NuGet packages:

After package is installed and JS engine is registered, need set a name of JS engine (for example, MsieJsEngine) to the name attribute of /configuration/bundleTransformer/autoprefixer/jsEngine configuration element in the Web.config file.

To make AutoprefixCssPostProcessor is one of the default CSS postprocessors, you need to make changes to the Web.config file. In the defaultPostProcessors attribute of /configuration/bundleTransformer/core/css element must be add AutoprefixCssPostProcessor to end of comma-separated list (for example, defaultPostProcessors="UrlRewritingCssPostProcessor,AutoprefixCssPostProcessor").

Additionally, you can specify the browser conditional expressions in the Web.config file (in the Visual Studio supported IntelliSense):

BundleTransformer.Autoprefixer options in the Web.config file

To clean CSS from any vendor prefixes, you just need to add the one conditional expression is equal to none:

<configuration>
  …
  <bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
    …
    <autoprefixer>
      <browsers>
        <add conditionalExpression="none" />
      </browsers>
      …
    </autoprefixer>
    …
  </bundleTransformer>
  …
</configuration>