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

Cache bust assets #16

Closed
wants to merge 7 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@philnash
Copy link
Contributor

philnash commented Jan 6, 2017

I noticed that @matiasgarciaisaia had referenced my blog post in #12 so I thought I'd take a crack at the task. This PR does a number of things to improve front end performance and avoid caching issues with CSS and JS.

  • Loads fonts using a tag instead of @import in the CSS
  • Stops loading Cousine weight 400, it isn't used
  • Tidies up the pygments colour files using some Sass nesting
  • Generates a single, minified stylesheet file with a digest in the filename
  • Generates a single, minified javascript file with a digest in the filename

Ensure that when you build the site, JEKYLL_ENV is set to production otherwise there will be no minifying and no digest.

philnash added some commits Jan 5, 2017

Adds Jekyll Assets and moves CSS to _assets directory.
This also inlines the two pygment colour files rather than making separate requests for them.
Improves loading of Google Fonts.
Loading fonts from the HTML instead of the CSS saves the browser having to download and parse the CSS before making the request for the font CSS.
All code is bold, so no need to load Cousine weight 400.
Moves all JS to bottom of body.
viewer.js would be render blocking the HTML while it downloads and parses.
Bundles JavaScripts together using sprockets.
Now we only have to load one JavaScript file at the bottom of the body and it can have a cache-busting digest too.
@philnash

This comment has been minimized.

Copy link
Contributor Author

philnash commented Jan 6, 2017

Hmm... this failed because Rack 2.0.1 requires Ruby >= 2.2.2 and the build is being run with 2.2.0.

I see that Travis is doing the build and then deploying (when on the master branch), I'll update the Ruby version to the latest in the 2.2.x series and try again.

@spalladino spalladino requested a review from bcardiff Jan 6, 2017

vtiffenberg pushed a commit that referenced this pull request Feb 3, 2017

@vtiffenberg

This comment has been minimized.

Copy link
Collaborator

vtiffenberg commented Feb 6, 2017

The redesign has diverged quite a bit from master, so instead of merging this pull request I applied its suggestions in 9fd9cc, a00cd9 and 613b23, and will close.
Thanks @philnash for the contribution.

@vtiffenberg vtiffenberg closed this Feb 6, 2017

@vtiffenberg vtiffenberg referenced this pull request Feb 6, 2017

Closed

Cache busting of assets #12

@philnash

This comment has been minimized.

Copy link
Contributor Author

philnash commented Feb 6, 2017

Thanks @vtiffenberg!

@matiasgarciaisaia

This comment has been minimized.

Copy link
Member

matiasgarciaisaia commented Feb 6, 2017

(I really should have taken at least 20 seconds to thank you, @philnash, instead of waiting to work on this. Anyways - thank you very much! 🎉 )

@philnash

This comment has been minimized.

Copy link
Contributor Author

philnash commented Feb 6, 2017

No worries! Just glad to help out. Let me know if there's anywhere else I can pitch in.

mverzilli added a commit that referenced this pull request Mar 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment