duai1683 2012-08-14 17:04
浏览 37
已采纳

基于PHP的javascript loader优化器?

I'm building a web-app framework and I'm looking for a way to compile javascript & css source files at runtime and I'm hoping for some suggestions.

I have used Require.js however the optimizer seems to depend on Node.js or Java/Rhino being installed which isnt ideal as I'd like to keep the dependencies down so that it can be run on any WAMP/LAMP environment (i.e. no Java/rhino or Node needed)

Ideally it would be something which at runtime looks for source updates and complies/minifies the js into a single flat file for instance <script src="js.php">

I have tried php packer however my tests have shown this to cause a bunch of javascript errors whenever I use it also its 6 years old now and doesnt seem to be actively in development.

YUI compressor & Google Closure again to my knowledge require Java.

Any suggestions welcomed!

  • 写回答

2条回答 默认 最新

  • douzhan4522 2012-08-14 20:11
    关注

    Minify seems to do exactly that. It serves minified Javascript and CSS files. It adds ETags in the headers and send 304 HTTP codes if it wasn't updated since last visit.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端