https://www.davepaquette.com/archive/2015/05/06/link-and-script-tag-helpers-in-mvc6.aspx

It is a common approach to reference popular frameworks from hosted CDN in order to reduce network load on your server and potentially improve performance for the end user. For popular frameworks like jQuery and Bootstrap, there is a good chance that the browser will already have a cached version of these files.

Referencing files from a CDN can be a bit of a pain because you also need to provide a fallback to a version of the file hosted on your servers. A fallback is necessary because you do not want your application to go down just because the CDN is not currently reachable.

The script and link tag helpers make it easier to specify a fallback test and file location. Here is a basic example for the popular Bootstrap framework:

<link rel="stylesheet" href="//ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/css/bootstrap.min.css"
asp-fallback-test-class="hidden"
asp-fallback-test-property="visibility"
asp-fallback-test-value="hidden" /> <script src="//ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/js/bootstrap.min.js"
asp-fallback-test="window.jQuery">
</script>

最新文章

  1. Bzoj3450 Tyvj1952 Easy
  2. 限制EditText最多输入多少汉字
  3. 吐槽!important专用博文
  4. C++实现反射机制
  5. [转]eclipse中使用maven插件的时候,运行run as maven build的时候报错
  6. Xcode中的Info.plist字段列表详解
  7. ctrl+c关闭多线程python程序
  8. linux建立信任关系
  9. Android手机配置gcc,实现手机编译代码
  10. 2014年1月9日 Oracle常见授权与权限回收[转]
  11. AFNetworking3.0的基本使用方法
  12. windows系统解决github.com访问超时
  13. 201521123001《Java程序设计》第8周学习总结
  14. K:图相关的最小生成树(MST)
  15. 线性回归(Linear Regression)均方误差损失函数最小化时关于参数theta的解析解的推导(手写)
  16. [Swift]LeetCode60. 第k个排列 | Permutation Sequence
  17. CODEVS 2455 繁忙的都市 SCOI2005(洛谷 P2330)
  18. Java数据类型转换规则
  19. 【译】第8节---EF Code First中配置类
  20. tar -cvzf a.tar.gz a --remove-files,tar命令执行原理

热门文章

  1. ONNX源码安装
  2. react+antd引入 阿里图标
  3. 通俗讲解python__new__()方法
  4. 【转】make menuconfig/.config/Kconfig解析
  5. js动态添加控件(输入框为例)
  6. Toast的基本用法 吐司打印
  7. 如何在国内跑Kubernetes的minikube
  8. checkbox 和 selected 混淆
  9. PHP程序员的技能图谱
  10. libusb bulk