public IRawString bundleJs(TemplateScopeContext scope, object virtualPaths, object options)
        {
            var args = options.AssertOptions(nameof(bundleJs));

            return(ViewUtils.BundleJs(nameof(bundleJs),
                                      Context.VirtualFiles,
                                      Minifiers.JavaScript,
                                      new BundleOptions {
                Sources = ViewUtils.ToStringList((IEnumerable)virtualPaths),
                OutputTo = args.TryGetValue("out", out var oOut) ? oOut as string : null,
                Minify = !args.TryGetValue("minify", out var oMinify) || oMinify is bool bMinify && bMinify,
                SaveToDisk = args.TryGetValue("disk", out var oDisk) && oDisk is bool bDisk && bDisk,
                Cache = !args.TryGetValue("cache", out var oCache) || oCache is bool bCache && bCache,
                RegisterModuleInAmd = args.TryGetValue("amd", out var oReg) && oReg is bool bReg && bReg,
            }).ToRawString());
        public IRawString bundleJs(object virtualPaths, object options)
        {
            var args = options.AssertOptions(nameof(bundleJs));

            return(ViewUtils.BundleJs(nameof(bundleJs),
                                      Context.VirtualFiles,
                                      HostContext.VirtualFiles,
                                      Minifiers.JavaScript,
                                      new BundleOptions {
                Sources = ViewUtils.ToStringList((IEnumerable)virtualPaths),
                OutputTo = args.TryGetValue("out", out var oOut) ? oOut as string : null,
                OutputWebPath = args.TryGetValue("outWebPath", out var oOutWebPath) ? oOutWebPath as string : null,
                PathBase = args.TryGetValue("pathBase", out var oPathBase) ? oPathBase as string : HostContext.Config.PathBase,
                Minify = !args.TryGetValue("minify", out var oMinify) || oMinify is bool bMinify && bMinify,
                SaveToDisk = args.TryGetValue("disk", out var oDisk) && oDisk is bool bDisk && bDisk,
                Cache = !args.TryGetValue("cache", out var oCache) || oCache is bool bCache && bCache,
                Bundle = !args.TryGetValue("bundle", out var oBundle) || oBundle is bool bBundle && bBundle,
                RegisterModuleInAmd = args.TryGetValue("amd", out var oReg) && oReg is bool bReg && bReg,
                IIFE = args.TryGetValue("iife", out var oIife) && oIife is bool bIife && bIife,
            }).ToRawString());
Exemplo n.º 3
0
 public static HtmlString BundleJs(this IHtmlHelper html, BundleOptions options) => ViewUtils.BundleJs(
     nameof(BundleJs), HostContext.VirtualFileSources, HostContext.VirtualFiles, Minifiers.JavaScript, options).ToHtmlString();