*.min.css
and *.min.js
) and minimize the code using only the means of the selected minimizer. For enabling / disabling the use of pre-minimized files, the usePreMinifiedFiles
attributes of the css
and js
configuration elements are responsible. The following example shows code that disables the use of pre-minimized files. <?xml version="1.0" encoding="utf-8"?> <configuration> ... <bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd"> <core> <css usePreMinifiedFiles="false"> ... </css> <js usePreMinifiedFiles="false"> ... </js> ... </core> ... </bundleTransformer> ... </configuration>
usePreMinifiedFiles
attributes are usePreMinifiedFiles
to true
.TypeScriptTranslator
adapter-translator that translates TypeScript code into JavaScript. If you have not heard anything about TypeScript, I recommend you read the following articles: “TypeScript: a language for developing large JavaScript applications” by Anatoly Alizar and “TypeScript for ASP.NET MVC 4 web applications” by Andrey Veselov.typeScript
configuration section in the Web.config
file: <?xml version="1.0" encoding="utf-8"?> <configuration> ... <bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd"> <typeScript useNativeMinification="false" useDefaultLib="true" propagateConstants="false" errorOnWith="true" inferPropertiesFromThisAssignment="false" codeGenTarget="EcmaScript3"> <style bitwise="false" blockInCompoundStatement="false" eqEqEq="false" forIn="false" emptyBlocks="true" newMustBeUsed="false" requireSemicolons="false" assignmentInConditions="false" eqNull="false" evalOk="true" innerScopeDeclarationsEscape="true" functionsInLoops="true" reDeclareLocal="true" literalSubscript="true" implicitAny="false" /> </typeScript> ... </bundleTransformer> ... </configuration>
useNativeMinification="(true|false)"
. Allows minimization of generated JS-code using TypeScript-compiler. With built-in minimization, whitespace and comments are removed. The code compressed in this way is no longer subject to minimization by means of the minimizer module, therefore, it is necessary to use the inline minimization only in cases when, for some reason, the minimizer module cannot be used. This configuration property controls two properties of the compiler at once: minWhitespace
and emitComments
.useDefaultLib="(true|false)"
. Allows the compiler to load definitions of common types declared in the file lib.d.ts
Common types include basic types from ECMAScript, DOM and Windows Script Host.<reference>
tags (for more information about this tag, you can read the article “Facilitating work with JS- and CSS-code in Visual Studio” ). /// <reference path="jquery.d.ts" /> /// <reference path="TranslatorBadge.ts" /> /// <summary> /// Creates colored badge for translator /// </summary> ;class ColoredTranslatorBadge extends TranslatorBadge { public getTextColor(): string { /// <summary> /// Gets a text color of badge /// </summary> /// <returns type="String"> /// Text color of badge /// </returns> return this.$linkElem.css("color"); } public setTextColor(color: string): void { /// <summary> /// Sets a text color of badge /// </summary> /// <param name="color" type="String"> /// Text color of badge /// </param> this.$linkElem.css("color", color); } public getBorderColor(): string { /// <summary> /// Gets a border color of badge /// </summary> /// <returns type="String"> /// Border color of badge /// </returns> return this.$badgeElem.css("border-color"); } public setBorderColor(color: string) { /// <summary> /// Sets a border color of badge /// </summary> /// <param name="color" type="String"> /// Border color of badge /// </param> this.$badgeElem.css("border-color", color); } }
<reference>
document tags add links to the jquery.d.ts
and TranslatorBadge.ts
files.Source: https://habr.com/ru/post/154629/
All Articles