Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report(viewer): minify inlined report-generator bundle #9596

Merged
merged 4 commits into from
Oct 11, 2019

Conversation

wardpeet
Copy link
Collaborator

@wardpeet wardpeet commented Aug 23, 2019

Summary
Brfs inlines readFileSync functions from report/html/html-report-assets.js inside viewer.js to generate an html report when clicking on saveHtml.

I've added a PR 94 to enable options to transform the file content. I have my doubts that it will get accepted but i've already pushed it to my own npm account to get feedback on this change. I'm happy to publish this under a different namespace or packagename.

The new options allow us to run terser on our js files and compress them. We'll save 18.96KB. The smaller the better is what I was thinking especially for a tool like Lighthouse 💪.

Before:
image

After:
image

This commit e4bc45a is the one you should look at.
This PR builds further on #9594

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would fix the first checkbox in #2591!

I have my doubts that it will get accepted but i've already pushed it to my own npm account to get feedback on this change.

given the rate of change on brfs I also don't hold out a lot of hope, but it's worth a try :) Implementation looks 👍

/**
* @param {string} file
*/
readFileSyncTransform: file => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably pull this out into a top-level named function

@brendankenny brendankenny changed the title feat(lighthouse-viewer): minify report generator (save ~20kb) report(viewer): minify inlined report-generator bundle Aug 23, 2019
@connorjclark
Copy link
Collaborator

i love how you made webpack in browserify :)

@wardpeet
Copy link
Collaborator Author

wardpeet commented Sep 3, 2019

@connorjclark it's now called wardpack 😂
@brendankenny Unsure if it ever will be handled, Feel free to push it under another handle. I don't mind pushing it under a non scoped package name myself.

*
* @param {string} file
*/
function minifyReadFileContent(file) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't really find a proper name for this function, suggestions are welcome

@connorjclark
Copy link
Collaborator

connorjclark commented Oct 11, 2019

I updated this PR but don't know how to push my changes to this PR, so I just opened a new one ... #9823

let's do thissss

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're going to live with @wardpeet/brfs for now until/if browserify/brfs#94 gets looked at :)

@wardpeet
Copy link
Collaborator Author

My legacy will live on! 🎉

@paulirish paulirish merged commit 94810f3 into GoogleChrome:master Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants