V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
PageSpeed 相关文档
为 NGINX 编译 PageSpeed 支持
ngx_pagespeed
Configuring mod_pagespeed Filters
加载性能测试工具
WebPagetest
Gomez
foomorrow

你们觉得这样使用requirejs怎么样 直觉上看有没有什么问题

  •  
  •   foomorrow · Dec 4, 2013 · 4429 views
    This topic created in 4537 days ago, the information mentioned may be changed or developed.
    把requirejs写在footer里
    如下
    2 replies    1970-01-01 08:00:00 +08:00
    foomorrow
        1
    foomorrow  
    OP
       Dec 4, 2013
    主要是利用 后端服务器的模板引擎 把require和一个全局的config 强制写到页面里 这样用可以减少http请求 也能减小r.js优化过的js文件的大小
    formvine
        2
    formvine  
       Dec 4, 2013   ❤️ 1
    1. 这种方式没办法同时利用压缩合并和source map,增大调试难度
    2. require并不是很小,同html合并输出一方面会损耗服务器性能,另一方面html文件增大会增加传输时间,很可能抵消一次请求所需时间。
    3. 夹在html里面的js不是单独文件,无法利用http Cache-Control启用客户端缓存
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   964 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 19:54 · PVG 03:54 · LAX 12:54 · JFK 15:54
    ♥ Do have faith in what you're doing.