如何将 UglifyJS 2 配置为仅在 C# 中连接?
How to configure UglifyJS 2 to only concatenate in C#?
我在我的 C# 项目中使用 UglifyJS2 for the Bundle Transformer NuGet 包,我只是希望能够连接我的 JS 文件而不为我的 QA 环境缩小它们,但我不知道该怎么做它。可能吗?
这是我当前的 Web.config Bundle Transformer 部分:
<bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
<core>
<css defaultMinifier="WgCssMinifier" usePreMinifiedFiles="true">
<translators>
<add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
<add name="SassAndScssTranslator" type="BundleTransformer.SassAndScss.Translators.SassAndScssTranslator, BundleTransformer.SassAndScss" />
</translators>
<postProcessors>
<add name="UrlRewritingCssPostProcessor" type="BundleTransformer.Core.PostProcessors.UrlRewritingCssPostProcessor, BundleTransformer.Core" useInDebugMode="false" />
</postProcessors>
<minifiers>
<add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
<add name="WgCssMinifier" type="BundleTransformer.WG.Minifiers.WgCssMinifier, BundleTransformer.WG" />
</minifiers>
<fileExtensions>
<add fileExtension=".css" assetTypeCode="Css" />
<add fileExtension=".sass" assetTypeCode="Sass" />
<add fileExtension=".scss" assetTypeCode="Scss" />
</fileExtensions>
</css>
<js defaultMinifier="UglifyJsMinifier" usePreMinifiedFiles="true">
<translators>
<add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
</translators>
<minifiers>
<add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
<add name="UglifyJsMinifier" type="BundleTransformer.UglifyJs.Minifiers.UglifyJsMinifier, BundleTransformer.UglifyJs" />
</minifiers>
<fileExtensions>
<add fileExtension=".js" assetTypeCode="JavaScript" />
</fileExtensions>
</js>
<assetHandler disableServerCache="false" serverCacheDurationInMinutes="15" disableClientCache="false" />
</core>
<uglify>
<js screwIe8="true" keepFunctionNames="false" severity="0">
<parsing strict="false" bareReturns="false" />
<compression compress="false" angular="true" />
<mangling mangle="false" />
<codeGeneration beautify="true" comments="all" />
</js>
<jsEngine name="V8JsEngine" />
</uglify>
<webGrease>
<css shouldMinify="true" ejectCharset="true" />
</webGrease>
尝试以下设置:
<bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
<core>
...
<js defaultMinifier="NullMinifier" ...>
...
</js>
...
</core>
...
</bundleTransformer>
我在我的 C# 项目中使用 UglifyJS2 for the Bundle Transformer NuGet 包,我只是希望能够连接我的 JS 文件而不为我的 QA 环境缩小它们,但我不知道该怎么做它。可能吗?
这是我当前的 Web.config Bundle Transformer 部分:
<bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
<core>
<css defaultMinifier="WgCssMinifier" usePreMinifiedFiles="true">
<translators>
<add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
<add name="SassAndScssTranslator" type="BundleTransformer.SassAndScss.Translators.SassAndScssTranslator, BundleTransformer.SassAndScss" />
</translators>
<postProcessors>
<add name="UrlRewritingCssPostProcessor" type="BundleTransformer.Core.PostProcessors.UrlRewritingCssPostProcessor, BundleTransformer.Core" useInDebugMode="false" />
</postProcessors>
<minifiers>
<add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
<add name="WgCssMinifier" type="BundleTransformer.WG.Minifiers.WgCssMinifier, BundleTransformer.WG" />
</minifiers>
<fileExtensions>
<add fileExtension=".css" assetTypeCode="Css" />
<add fileExtension=".sass" assetTypeCode="Sass" />
<add fileExtension=".scss" assetTypeCode="Scss" />
</fileExtensions>
</css>
<js defaultMinifier="UglifyJsMinifier" usePreMinifiedFiles="true">
<translators>
<add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
</translators>
<minifiers>
<add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
<add name="UglifyJsMinifier" type="BundleTransformer.UglifyJs.Minifiers.UglifyJsMinifier, BundleTransformer.UglifyJs" />
</minifiers>
<fileExtensions>
<add fileExtension=".js" assetTypeCode="JavaScript" />
</fileExtensions>
</js>
<assetHandler disableServerCache="false" serverCacheDurationInMinutes="15" disableClientCache="false" />
</core>
<uglify>
<js screwIe8="true" keepFunctionNames="false" severity="0">
<parsing strict="false" bareReturns="false" />
<compression compress="false" angular="true" />
<mangling mangle="false" />
<codeGeneration beautify="true" comments="all" />
</js>
<jsEngine name="V8JsEngine" />
</uglify>
<webGrease>
<css shouldMinify="true" ejectCharset="true" />
</webGrease>
尝试以下设置:
<bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
<core>
...
<js defaultMinifier="NullMinifier" ...>
...
</js>
...
</core>
...
</bundleTransformer>