/// <summary>
 /// Compile markdown files on the asset pipeline.
 /// </summary>
 /// <param name="pipeline">The asset pipeline.</param>
 /// <param name="route">The route where the compiled markdown file will be available from.</param>
 /// <param name="sourceFiles">The path to the markdown source files to compile.</param>
 public static IAsset AddTypeScriptBundle(this IAssetPipeline pipeline, string route, params string[] sourceFiles)
 {
     return(pipeline.AddBundle(route, "application/javascript; charset=UTF-8", sourceFiles)
            .CompileTypeScript()
            .Concatenate()
            .MinifyJavaScript());
 }
 /// <summary>
 /// Creates a JavaScript bundle on the specified route and minifies the output.
 /// </summary>
 public static IAsset AddJavaScriptBundle(this IAssetPipeline pipeline, string route, CodeSettings settings, params string[] sourceFiles)
 {
     return(pipeline.AddBundle(route, "application/javascript; charset=UTF-8", sourceFiles)
            .EnforceFileExtensions(".js", ".jsx", ".es5", ".es6")
            .Concatenate()
            .MinifyJavaScript(settings));
 }
Beispiel #3
0
 /// <summary>
 /// Creates a HTML bundle on the specified route and minifies the output.
 /// </summary>
 public static IAsset AddHtmlBundle(this IAssetPipeline pipeline, string route, HtmlSettings settings, params string[] sourceFiles)
 {
     return(pipeline.AddBundle(route, "text/html; charset=UTF-8", sourceFiles)
            .EnforceFileExtensions(".htm", ".html", ".xhtml", ".xhtm", ".shtml", ".shtm", ".js", ".nj", ".njk", ".njs", ".nunj", ".nunjs", ".nunjucks", ".smarty", ".svg", ".tpl", ".vue", ".vash", ".ejs", ".erb", ".liquid", ".lava", "..spark", ".cfm", ".kit", ".brail", ".twig", ".tag")
            .Concatenate()
            .MinifyHtml(settings));
 }
Beispiel #4
0
 /// <summary>
 /// Creates a JavaScript bundle on the specified route and minifies the output.
 /// </summary>
 public static IAsset AddJavaScriptBundle(this IAssetPipeline pipeline, string route, CodeSettings settings, params string[] sourceFiles)
 {
     return(pipeline.AddBundle(route, "text/javascript; charset=UTF-8", sourceFiles)
            .EnforceFileExtensions(".js", ".jsx", ".es5", ".es6")
            .Concatenate()
            .AddResponseHeader("X-Content-Type-Options", "nosniff")
            .MinifyJavaScript(settings));
 }
Beispiel #5
0
        private static IAsset AddBundleByKey(IAssetPipeline pipeline, string route,
                                             string contentType)
        {
            var asset = (Asset)pipeline.AddBundle(route, contentType, EmptySourceFiles);

            asset.SourceFiles = new HashSet <string>();
            return(asset);
        }
 /// <summary>
 /// Compile Sass or Scss files on the asset pipeline.
 /// </summary>
 /// <param name="pipeline">The asset pipeline.</param>
 /// <param name="route">The route where the compiled .css file will be available from.</param>
 /// <param name="sourceFiles">The path to the .sass or .scss source files to compile.</param>
 public static IAsset AddScssBundle(this IAssetPipeline pipeline, string route, params string[] sourceFiles)
 {
     return(pipeline.AddBundle(route, "text/css; charset=UTF-8", sourceFiles)
            .CompileScss()
            .AdjustRelativePaths()
            .Concatenate()
            .FingerprintUrls()
            .MinifyCss());
 }
Beispiel #7
0
 /// <summary>
 /// Creates a CSS bundle on the specified route and minifies the output.
 /// </summary>
 public static IAsset AddCssBundle(this IAssetPipeline pipeline, string route, CssSettings settings, params string[] sourceFiles)
 {
     return(pipeline.AddBundle(route, "text/css; charset=UTF-8", sourceFiles)
            .EnforceFileExtensions(".css")
            .AdjustRelativePaths()
            .Concatenate()
            .FingerprintUrls()
            .MinifyCss(settings));
 }
Beispiel #8
0
 /// <summary>
 /// Compile Sass or Scss files on the asset pipeline.
 /// </summary>
 /// <param name="pipeline">The asset pipeline.</param>
 /// <param name="route">The route where the compiled .css file will be available from.</param>
 /// <param name="sourceFiles">The path to the .sass or .scss source files to compile.</param>
 public static IAsset AddScssBundle(this IAssetPipeline pipeline, string route, params string[] sourceFiles)
 {
     return(pipeline.AddBundle(route, "text/css; charset=UTF-8", sourceFiles)
            .CompileScss()
            .AdjustRelativePaths()
            .Concatenate()
            //    .FingerprintUrls()
            .AddResponseHeader("X-Content-Type-Options", "nosniff")
            .MinifyCss());
 }
        /// <summary>
        ///  Creates AngularJs bundle from HTML templates.
        /// </summary>
        /// <param name="pipeline">The asset pipeline.</param>
        /// <param name="route">The route where the compiled .html file will be available from.</param>
        /// <param name="moduleSettings"></param>
        /// <param name="sourceFiles">The path to the .html source files to compile.</param>
        public static IAsset AddHtmlTemplateBundle(this IAssetPipeline pipeline, string route,
                                                   AngularTemplateOptions moduleSettings,
                                                   params string[] sourceFiles)
        {
            Guard.ArgumentIsNotNull(moduleSettings, "Can't be null");

            return(pipeline.AddBundle(route, "text/javascript; charset=UTF-8", sourceFiles)
                   .AdjustRelativePaths()
                   .TransformHtml(moduleSettings));
        }
Beispiel #10
0
 /// <summary>
 /// Compile markdown files on the asset pipeline.
 /// </summary>
 /// <param name="pipeline">The asset pipeline.</param>
 /// <param name="route">The route where the compiled markdown file will be available from.</param>
 /// <param name="sourceFiles">The path to the markdown source files to compile.</param>
 public static IAsset AddMarkdownBundle(this IAssetPipeline pipeline, string route, params string[] sourceFiles)
 {
     return(pipeline.AddBundle(route, "text/html; charset=UTF-8", sourceFiles)
            .CompileMarkdown()
            .Concatenate());
 }