【问题标题】:MVC Bundle JS with Config from CDN带有来自 CDN 的 Config 的 MVC Bundle JS
【发布时间】:2017-06-26 20:35:25
【问题描述】:

我正在尝试捆绑一个在 MVC 4 中具有配置的 JS 文件,

http://cdn.mathjax.org/mathjax/latest/MathJax.js?配置=TeX-AMS-MML_HTMLorMML

BundleConfig.cs 文件,

        bundles.Add(new ScriptBundle("~/bundles/MathJax").Include(
       "~/Scripts/MathJax/MathJax.jsMathJax.js?config=TeX-AMS-MML_HTMLorMML"));

_Layout.chtml 文件

@Scripts.Render("~/bundles/MathJax")

当我在标头中包含 JS 时,它可以工作,但在包含在 Bundle 中时不起作用。

我尝试将配置添加到渲染部分,

BundleConfig.cs 文件,

        bundles.Add(new ScriptBundle("~/bundles/MathJax").Include(
       "~/Scripts/MathJax/MathJax.jsMathJax.js"));

_Layout.chtml 文件

@Scripts.Render("~/bundles/MathJax?config=TeX-AMS-MML_HTMLorMML")

【问题讨论】:

  • 你试过使用cdn参数吗? bundles.UseCdn = true; bundles.Add(new ScriptBundle("~/virtual", "http://cdn...").Include("~/local"))
  • 我想使用静态库并避免内容交付网络过载。
  • 大家找到解决办法了吗?

标签: asp.net-mvc-4 bundle mathjax


【解决方案1】:

MathJax 有很多依赖项,似乎不支持捆绑。它需要对 js 文件本身进行大量更改,并且无法支持。

所以你的问题的答案是。 不,您不能捆绑 Mathjax。

【讨论】:

  • 我最终使用了 katex (katex.org)。它目前只是一个候选版本,但可以满足我的需求
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-07-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-06-09
  • 2018-01-28
  • 1970-01-01
相关资源
最近更新 更多