{"action":"created","issue":{"url":"https://api.github.com/repos/modxcms/revolution/issues/12611","labels_url":"https://api.github.com/repos/modxcms/revolution/issues/12611/labels{/name}","comments_url":"https://api.github.com/repos/modxcms/revolution/issues/12611/comments","events_url":"https://api.github.com/repos/modxcms/revolution/issues/12611/events","html_url":"https://github.com/modxcms/revolution/pull/12611","id":103538079,"number":12611,"title":"Grunt away compress_js and make Manager not broken","user":{"login":"jpdevries","id":592335,"avatar_url":"https://avatars.githubusercontent.com/u/592335?v=3","gravatar_id":"","url":"https://api.github.com/users/jpdevries","html_url":"https://github.com/jpdevries","followers_url":"https://api.github.com/users/jpdevries/followers","following_url":"https://api.github.com/users/jpdevries/following{/other_user}","gists_url":"https://api.github.com/users/jpdevries/gists{/gist_id}","starred_url":"https://api.github.com/users/jpdevries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpdevries/subscriptions","organizations_url":"https://api.github.com/users/jpdevries/orgs","repos_url":"https://api.github.com/users/jpdevries/repos","events_url":"https://api.github.com/users/jpdevries/events{/privacy}","received_events_url":"https://api.github.com/users/jpdevries/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-08-27T15:41:10Z","updated_at":"2015-08-28T12:13:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/modxcms/revolution/pulls/12611","html_url":"https://github.com/modxcms/revolution/pull/12611","diff_url":"https://github.com/modxcms/revolution/pull/12611.diff","patch_url":"https://github.com/modxcms/revolution/pull/12611.patch"},"body":"In MODX 2.4- a server-side minifier is used to concatenate and minify CSS and Javascript files that are added with the MODX API. This PR begs we abandon that methodology completely so that we can ship a more performant, more optimized, and more stable product.\r\n\r\nTargets MODX 2.5. I can flatten the commits if you'd like. Keeping granular for now.\r\n\r\nI'm not sure why it can't automatically be merged. Probably because I started the PR a while ago. Let me know if you'd like me to rebase or reassemble it.\r\n\r\nYou won't find it in the code but this PR also asks that we have a conversation about how we look at HTTP Requests in regards to performance. They aren't all bad and in use cases like a dynamic Manager whose assets can change from page to page or as plugins are updated, activated, or deactivated to combine everything together is drastically worse for performance when measured in any practical test.\r\n\r\n_I’ve gotten a lot of resistance trying to remove these settings over the past three years however they were never tested or really architected to consider how browsers cache files so it has honestly been frustrating to be expected to prove why they need to go away considering they were never proven they should be there in the first place._\r\n\r\nPlease keep in mind that browsers cache files based off the files URL. Anyone is obviously welcome to pull from this branch and post performance and optimization findings.\r\n\r\n### What it does\r\n - Adds a Grunt workflow that creates an unminified and a minified version of the global core Javascript assets for the MODX Manager with _nothing else added_\r\n   - `<%= dirs.manager %>assets/modext/modx.jsgrps.js`\r\n   - `<%= dirs.manager %>assets/modext/modx.jsgrps-min.js`\r\n - adjusts the core backend to ignore `compress_` settings. This means extra assets will not be grouped together. Nor should they be.\r\n - removes the manager/min directory :tada: \r\n - fixes all the sites that suffer from the below related issues\r\n - potentially increases the number of HTTP requests a manager page may have but in doing so utilizes an architecture designed to load assets sensibly and more efficiently. https://github.com/modxcms/revolution/pull/12538#issuecomment-134946207\r\n - takes us one step closer to a CDN hosted workflow that would mean logging into one MODX dashboard caches the assets for the 19 MODX sites you haven't logged into yet today. This would make MODX feel _much snappier_ across the web but as I believe @adamwintle brought up there must be proper fallbacks for not only offline use but in countries like China that block CDNs. Anyways I think we should shoot for that, and maybe likewise support in the API, for MODX 3 personally.\r\n\r\nmodx.jsgrps.js contains the several modxext scripts that are needed for the core. If `compress_js` is enabled the `modx.jsgrps-min.js` file will be served, but the server won't concat or minify anything at all. Extras that use the API to load CSS and JS assets will still work as expected when compress_js was disabled in 2.4-.\r\n\r\n### What it doesn't do\r\n - Break any backwards compatibility\r\n - Break the MODX Manager in certain environments https://github.com/modxcms/revolution/issues/12478\r\n - Break the MODX Manager in any environment that uses the API to load off domain assets https://github.com/modxcms/revolution/issues/12610\r\n - Breaks the MODX Manager if a file it is supposed to concat isn't found https://github.com/modxcms/revolution/issues/12609\r\n - Break MODX Extras\r\n - concat and minify Extra developers assets for them\r\n\r\n#### Also see\r\nSet compress_js and compress_css system settings to false by default. https://github.com/modxcms/revolution/pull/12538 (discussion on performance and optimization)\r\nReduce Manager JS HTTP Requests https://github.com/modxcms/revolution/pull/11527\r\nAdd notes about GZIP to Docs or Installation Instructions? https://github.com/modxcms/docs/issues/94 (GZIP)\r\n\r\n#### Closes\r\n - [Bug?] CSS/JS compress kills backend (white screen of death)? https://github.com/modxcms/revolution/issues/12478\r\n - Manager Crashes HARD if min library can't find a file https://github.com/modxcms/revolution/issues/12609\r\n - Manager Breaks when loading off domain assets with API and compress_js https://github.com/modxcms/revolution/issues/12610\r\n\r\n#### Related Issues & PRs\r\n - Set compress_js and compress_css system settings to false by default. https://github.com/modxcms/revolution/pull/12538\r\n - Grunt minify javascript proof of concept https://github.com/modxcms/revolution/pull/11682\r\n - compress_js_groups breaking manager? https://github.com/modxcms/revolution/issues/11515\r\n - Reduce Manager JS HTTP Requests https://github.com/modxcms/revolution/pull/11527\r\n - Setup says js compression was disabled but it wasn't https://github.com/modxcms/revolution/issues/7265\r\n - Serious javascript errors in managers https://github.com/modxcms/revolution/issues/5831\r\n - Compressed JS doesn't work after 6 files to compress https://github.com/modxcms/revolution/issues/5840\r\n - Blank Screen in Revo 2.2.0 Manager https://github.com/modxcms/revolution/issues/6509\r\n - edit resource is broken https://github.com/modxcms/revolution/issues/5508\r\n - Manager compression causes Webkit-based browser to bail https://github.com/modxcms/revolution/issues/8168\r\n - Minify problem in manager on staging server xxx.xxx.xxx.xxx/~xxx address https://github.com/modxcms/revolution/issues/6247\r\n\r\n\r\n#### Note\r\nThere is a new `grunt compress` task so that the `grunt build` task doesn't get slow from having to process all the core files each time. So run `grunt build && grunt compress` when in doubt.\r\n\r\n#### Notice\r\n![](http://j4p.us/image/1Y0T3A3f2a1D/Screen%20Shot%202015-08-27%20at%208.58.55%20AM.png)\r\nExtra assets such as redactor-1.5.3.min.js are not combined with the minified core files"},"comment":{"url":"https://api.github.com/repos/modxcms/revolution/issues/comments/135755601","html_url":"https://github.com/modxcms/revolution/pull/12611#issuecomment-135755601","issue_url":"https://api.github.com/repos/modxcms/revolution/issues/12611","id":135755601,"user":{"login":"Mark-H","id":312944,"avatar_url":"https://avatars.githubusercontent.com/u/312944?v=3","gravatar_id":"","url":"https://api.github.com/users/Mark-H","html_url":"https://github.com/Mark-H","followers_url":"https://api.github.com/users/Mark-H/followers","following_url":"https://api.github.com/users/Mark-H/following{/other_user}","gists_url":"https://api.github.com/users/Mark-H/gists{/gist_id}","starred_url":"https://api.github.com/users/Mark-H/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mark-H/subscriptions","organizations_url":"https://api.github.com/users/Mark-H/orgs","repos_url":"https://api.github.com/users/Mark-H/repos","events_url":"https://api.github.com/users/Mark-H/events{/privacy}","received_events_url":"https://api.github.com/users/Mark-H/received_events","type":"User","site_admin":false},"created_at":"2015-08-28T12:13:55Z","updated_at":"2015-08-28T12:13:55Z","body":"... making good progress though ;)"}}