Yslow on Nodejs server

1. 目的:用yslow测试某个页面的性能node

2. 需求:返回yslow测试后的数据,显示在页面git

 

方法1、 nodejsgithub

  须要把网址打包为har格式...bash

方法2、 phantomjs性能

步骤:测试

  1. 安装phantomjs, brew phantomjslua

  2. 测试: phantomjs yslow.js --info basic http://www.baidu.comspa

  3. 问题来了,报错:命令行

   TypeError: undefined is not an object (evaluating 'args.length')code

    phantomjs://code/yslow.js:5 in global code

   缘由是yslow官方提供的yslow.js 和 phantomjs2.x版本不兼容

   解决办法:下载yslow git repo,替换phantomjs/controller.js 为这哥们修改后的: https://github.com/marcelduran/yslow/issues/172。

   而后执行 make phantomjs 从新生成新的yslow.js

  4. 回到第二步,done~

  5. 能够用node里的 child_progress.spawn来获取命令行返回的数据

相关文章
相关标签/搜索