Skip to content

Instantly share code, notes, and snippets.

@qiulang
Created March 21, 2018 04:01
Show Gist options
  • Save qiulang/1497962c8d483d631c638b77708666c5 to your computer and use it in GitHub Desktop.
Save qiulang/1497962c8d483d631c638b77708666c5 to your computer and use it in GitHub Desktop.
如何在项目开发中使用CDN
  1. 前端代码用到的第三库发布时候使用CDN;但为了方便开发,开发阶段使用本地库。
  2. 大致比较国内可用CDN,两个可选:
    1. http://www.bootcdn.cn/ bootscrap
    2. http://jscdn.upai.com/ 又拍云
    3. https://segmentfault.com/a/1190000000311560 segmentfault.com同样用又拍云的CDN
  3. gulp和webpack分别有这样插件,让开发时候使用本地库,发布时候使用CDN
    1. webpack-cdn-plugin 传prodUrl参数设置CDN,具体参见webpack.spec.js测试用例, 实现细节看参见 webpack externals
    2. gulp-cndizer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment