/// <summary>Replaces a file extensions of script assets</summary>
        /// <param name="assets">Set of script assets</param>
        /// <param name="isDebugMode">Flag that web application is in debug mode</param>
        /// <returns>Set of script assets with a modified extension</returns>
        protected override IList <IAsset> ReplaceFileExtensions(
            IList <IAsset> assets,
            bool isDebugMode)
        {
            JsFileExtensionsFilter extensionsFilter = new JsFileExtensionsFilter(this._jsFilesWithMsStyleExtensions);

            extensionsFilter.IsDebugMode         = isDebugMode;
            extensionsFilter.UsePreMinifiedFiles = this.UsePreMinifiedFiles;
            return(extensionsFilter.Transform(assets));
        }
        /// <summary>
        /// Replaces a file extensions of script assets
        /// </summary>
        /// <param name="assets">Set of script assets</param>
        /// <param name="isDebugMode">Flag that web application is in debug mode</param>
        /// <returns>Set of script assets with a modified extension</returns>
        protected override IList <IAsset> ReplaceFileExtensions(IList <IAsset> assets, bool isDebugMode)
        {
            var jsFileExtensionsFilter = new JsFileExtensionsFilter(_jsFilesWithMsStyleExtensions)
            {
                IsDebugMode         = isDebugMode,
                UsePreMinifiedFiles = UsePreMinifiedFiles
            };

            IList <IAsset> processedAssets = jsFileExtensionsFilter.Transform(assets);

            return(processedAssets);
        }
Exemplo n.º 3
0
        public void ReplacementOfFileExtensionsInReleaseModeAndUsageOfPreMinifiedFilesDisallowedIsCorrect()
        {
            // Arrange
            IList <IAsset> assets = GetTestAssets();
            var            jsFileExtensionsFilter = new JsFileExtensionsFilter(_jsFilesWithMicrosoftStyleExtensions,
                                                                               _virtualFileSystemWrapper)
            {
                IsDebugMode         = false,
                UsePreMinifiedFiles = false
            };

            // Act
            IList <IAsset> processedAssets    = jsFileExtensionsFilter.Transform(assets);
            IAsset         jqueryAsset        = processedAssets[0];
            IAsset         jqueryUiAsset      = processedAssets[1];
            IAsset         microsoftAjaxAsset = processedAssets[2];
            IAsset         knockoutAsset      = processedAssets[3];
            IAsset         modernizrAsset     = processedAssets[4];

            // Assert
            Assert.Equal(UrlHelpers.Combine(SCRIPTS_DIRECTORY_VIRTUAL_PATH, "jquery-1.6.2.js"),
                         jqueryAsset.VirtualPath);
            Assert.Equal(UrlHelpers.Combine(SCRIPTS_DIRECTORY_VIRTUAL_PATH, "jquery-ui-1.8.11.js"),
                         jqueryUiAsset.VirtualPath);
            Assert.Equal(UrlHelpers.Combine(SCRIPTS_DIRECTORY_VIRTUAL_PATH, "MicrosoftAjax.debug.js"),
                         microsoftAjaxAsset.VirtualPath);
            Assert.Equal(UrlHelpers.Combine(SCRIPTS_DIRECTORY_VIRTUAL_PATH, "knockout-2.1.0beta.debug.js"),
                         knockoutAsset.VirtualPath);
            Assert.Equal(UrlHelpers.Combine(SCRIPTS_DIRECTORY_VIRTUAL_PATH,
                                            "modernizr-2.0.6-development-only.js"), modernizrAsset.VirtualPath);
            Assert.NotEqual(UrlHelpers.Combine(SCRIPTS_DIRECTORY_VIRTUAL_PATH,
                                               "modernizr-2.0.6-development-only.min.js"), modernizrAsset.VirtualPath);

            Assert.False(jqueryAsset.Minified);
            Assert.False(jqueryUiAsset.Minified);
            Assert.False(microsoftAjaxAsset.Minified);
            Assert.False(knockoutAsset.Minified);
            Assert.False(modernizrAsset.Minified);
        }
		/// <summary>
		/// Replaces a file extensions of script assets
		/// </summary>
		/// <param name="assets">Set of script assets</param>
		/// <param name="isDebugMode">Flag that web application is in debug mode</param>
		/// <returns>Set of script assets with a modified extension</returns>
		protected override IList<IAsset> ReplaceFileExtensions(IList<IAsset> assets, bool isDebugMode)
		{
			var jsFileExtensionsFilter = new JsFileExtensionsFilter(_jsFilesWithMsStyleExtensions)
			{
			    IsDebugMode = isDebugMode,
				UsePreMinifiedFiles = UsePreMinifiedFiles
			};

			IList<IAsset> processedAssets = jsFileExtensionsFilter.Transform(assets);

			return processedAssets;
		}