-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[6.0.1] CSS / JS files are not bundled into one file #7186
Description
Priority: Medium
Impacts: User experience, performance, server load, scaling
The oC web UI issues separate requests for CSS and JS files:
<link rel="stylesheet" href="/remote.php/core.css?v=74b4d273507a7e0eba857955bd45b2cf" type="text/css" media="screen" />
<link rel="stylesheet" href="/index.php/apps/files/css/files.css?v=74b4d273507a7e0eba857955bd45b2cf" type="text/css" media="screen" />
<link rel="stylesheet" href="/index.php/apps/files/css/upload.css?v=74b4d273507a7e0eba857955bd45b2cf" type="text/css" media="screen" />
<script type="text/javascript" src="/index.php/core/js/config.js?v=74b4d273507a7e0eba857955bd45b2cf"></script>
<script type="text/javascript" src="/remote.php/core.js?v=74b4d273507a7e0eba857955bd45b2cf"></script>
<script type="text/javascript" src="/apps/files/js/file-upload.js?v=74b4d273507a7e0eba857955bd45b2cf"></script>
<script type="text/javascript" src="/apps/files/js/jquery.iframe-transport.js?v=74b4d273507a7e0eba857955bd45b2cf"></script>
<script type="text/javascript" src="/apps/files/js/jquery.fileupload.js?v=74b4d273507a7e0eba857955bd45b2cf"></script>
<script type="text/javascript" src="/apps/files/js/jquery-visibility.js?v=74b4d273507a7e0eba857955bd45b2cf"></script>
<script type="text/javascript" src="/apps/files/js/filelist.js?v=74b4d273507a7e0eba857955bd45b2cf"></script>
<script type="text/javascript" src="/apps/files/js/fileactions.js?v=74b4d273507a7e0eba857955bd45b2cf"></script>
<script type="text/javascript" src="/apps/files/js/files.js?v=74b4d273507a7e0eba857955bd45b2cf"></script>
<script type="text/javascript" src="/apps/files/js/keyboardshortcuts.js?v=74b4d273507a7e0eba857955bd45b2cf"></script>
</head>
This is unfortunate on multiple levels:
a) too many HTTP requests, add time for page load
b) some of the requests are going to index.php or remote.php instead of the to the filesystem. Requests to the filesystem can be handled efficiently by the web server and don't incur the startup cost of PHP.
c) the only thing index.php and remote.php seem to do is to minify the JavaScript file. With around 200ms spent waiting for the PHP request to be handled, the benefits of compressing the JS online are dwarfed by the the time it takes to do that and the 4 calls to a PHP script
Best practice is to combine & compress JS and CSS files, resulting in just two files that can be statically delivered
Evidence is shown S3 under Support/CSS_JS
The Network console shows all network requests, and the time it takes. The column "Time/Latency" shows how long each request takes. For the PHP based requests, we regularly see > 150ms latency (up to 911ms in one case).
Reducing the number of requests, and not going through the PHP layer for static files (JS/CSS) should greatly improve the performance of the WebUI.
There are tools available that will help doing that: http://gruntjs.com for "on deployment" compacting/combining