Conversation
b01f84d to
ac7d11b
Compare
b337bd5 to
4b2e664
Compare
|
This is great, but I'm moving it to 4.6, sorry. |
|
@ebinnion -- is this still alive/in progress? |
|
It looks like it needs a rebase to bring it up to date, but it should be ready besides that. |
ff4a870 to
f21760b
Compare
|
@samhotchkiss - I've rebased the PR, so it should be ready for a review. |
|
@ebinnion works as discrived! My only concern with the changes is if they are compatible with merging them back to wpcom, with paths relying on |
|
Good call, Miguel. @georgestephanis, what do we normally do about that? |
|
@samhotchkiss Well, WPCOM handles the minifying on its own, so if we basically add in the conditional something like... So basically the (this could be avoided if wpcom has something in place to ensure min isn't pulled in by default, but it probably doesn't) Also, I'd like to be absolutely clear that we are not able to use Uglify's |
|
Also, I would very much argue against locating the minified files in a different directory from the original files. They should be side by side for understandability. |
|
@ebinnion, See George's comments above |
8e2260b to
d8dc2d7
Compare
|
I just pushed a couple of commits that I believe address @georgestephanis's feedback. This PR should be ready for review again. |
|
"that should not be source controlled" -- out of curiosity, do we have / need / should we consider a way to make sure Jetpack doesn't try to include minified sources for these files, if someone has just loaded a pre-built version from git? Or at least display an error saying how to build, instead of not working? |
|
That is definitely another route that we could go. I did not do that in this PR since I noticed at least one other place in the existing code where we were calling a minified file. And while briefly browsing, I see at least 4 places where we're directly calling minified JS files. So, we'd want to update those calls to be conditional. |
|
@samhotchkiss @georgestephanis do we want to move forward with this? |
|
Also suggested here: |
3b8fb60 to
626a382
Compare
626a382 to
194cde8
Compare
|
@dereksmart - I rebased this PR and tested it manually, and it seems to be working. There's a failing unit test for some reason though. Have you ran into something like this? |
|
Closing since this doesn't seem to have traction. Feel free to open and take it over if you'd like. |
After running a performance report on my site this weekend, I realized that the frontend JS that we use for our modules is not minified/uglified. 😞
Before
This PR seeks to use the uglified versions of much of the frontend JS that we load. Here is an after for comparison.
After
The pros
You can see that I was able to knock off about 25 Kb with this PR. So, that's great! Plus, you can also see that the YSlow and PageSpeed scores both went up for my site. This will be welcomed by users.
Another pro is that we are only loading the uglified versions of these files on the frontend and when
SCRIPT_DEBUGis nottrue. This will allow users the ability to opt out of the minified files if it is an issue for their setup.The cons
The biggest cons I can think of are that this is not an automated solution. Future work will require that we first add the target file to
gulpfile.jsand then we must conditionally enqueue that. 😞I had considered implementing a module to minify and concatenate all JS into one file, but that gets pretty interesting and is a bit out of this initial scope.
To test
update/gulp-minify-jsbranchyarn build*.min.jswp-config.php, setdefine( 'SCRIPT_DEBUG', true );