Example #1
0
        /// <summary>
        /// Registers the javascript.
        /// </summary>
        /// <param name="combiner">The combiner.</param>
        /// <param name="key">The key.</param>
        /// <param name="resourceRegistry">The resource registry.</param>
        /// <param name="javascriptHash">The javascript hash.</param>
        private void RegisterJavascript(CombinerConfig combiner, string key, IStaticResourceRegistry resourceRegistry, long javascriptHash)
        {
            if (combiner.JavascriptFiles.Count < 1)
            {
                return;
            }

            var script = CombineJSFileContent(combiner.JavascriptFiles);

            if (ScriptBuilder.Minify)
            {
                script = ScriptBuilder.CompressJavascript(script);
            }

            var staticContentResource = new StaticContentResource(script);

            resourceRegistry.RegisterCustomResource(key, null, javascriptHash.ToString(), staticContentResource,
                                                    "application/x-javascript", DateTime.Now);
        }
Example #2
0
        /// <summary>
        /// Registers the CSS.
        /// </summary>
        /// <param name="combiner">The combiner.</param>
        /// <param name="resourceRegistry">The resource registry.</param>
        /// <param name="cssKey">The CSS key.</param>
        /// <param name="cssHash">The CSS hash.</param>
        private void RegisterCss(CombinerConfig combiner, IStaticResourceRegistry resourceRegistry, string cssKey, long cssHash)
        {
            if (combiner.CssFiles.Count < 1)
            {
                return;
            }

            var css = CombineCssFileContent(combiner);

            if (ScriptBuilder.Minify)
            {
                css = ScriptBuilder.CompressCSS(css);
            }

            var cssResource = new StaticContentResource(css);

            resourceRegistry.RegisterCustomResource(cssKey, null, cssHash.ToString(), cssResource,
                                                    "text/css", DateTime.Now);
        }
		/// <summary>
		/// Registers the javascript.
		/// </summary>
		/// <param name="combiner">The combiner.</param>
		/// <param name="key">The key.</param>
		/// <param name="resourceRegistry">The resource registry.</param>
		/// <param name="javascriptHash">The javascript hash.</param>
		private void RegisterJavascript(CombinerConfig combiner, string key, IStaticResourceRegistry resourceRegistry, long javascriptHash)
		{
			if (combiner.JavascriptFiles.Count < 1) return;

			var script = CombineJSFileContent(combiner.JavascriptFiles);

			if (ScriptBuilder.Minify)
				script = ScriptBuilder.CompressJavascript(script);

			var staticContentResource = new StaticContentResource(script);

			resourceRegistry.RegisterCustomResource(key, null, javascriptHash.ToString(), staticContentResource,
													"application/x-javascript", DateTime.Now);
		}
		/// <summary>
		/// Registers the CSS.
		/// </summary>
		/// <param name="combiner">The combiner.</param>
		/// <param name="resourceRegistry">The resource registry.</param>
		/// <param name="cssKey">The CSS key.</param>
		/// <param name="cssHash">The CSS hash.</param>
		private void RegisterCss(CombinerConfig combiner, IStaticResourceRegistry resourceRegistry, string cssKey, long cssHash)
		{
			if (combiner.CssFiles.Count < 1) return;

			var css = CombineCssFileContent(combiner);

			if (ScriptBuilder.Minify)
				css = ScriptBuilder.CompressCSS(css);

			var cssResource = new StaticContentResource(css);

			resourceRegistry.RegisterCustomResource(cssKey, null, cssHash.ToString(), cssResource,
													"text/css", DateTime.Now);
		}