Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Remove CDN to match Theme Submission Guidelines #66

Merged
merged 19 commits into from
Feb 29, 2020
Merged

Conversation

pacollins
Copy link
Owner

Description

All resources have been downloaded to the theme directory so that there isn't a reliance on CDNs.

⚠️ Change and new parameter: .Site.Params.enableCDN defaults to false to adhere to guidelines. Setting to true enables CDNs.

Motivation and Context

Closes #56 and address Theme Submission Guidelines

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

There are accessibility issues in these changes.

static/js/jquery.min.js Outdated Show resolved Hide resolved
static/js/fancybox.min.js Outdated Show resolved Hide resolved
layouts/partials/head.html Outdated Show resolved Hide resolved
@pacollins
Copy link
Owner Author

pacollins commented Aug 16, 2019 via email

@pacollins pacollins self-assigned this Aug 18, 2019
@pacollins
Copy link
Owner Author

pacollins commented Aug 18, 2019

Now that I have explored Hugo Pipes (thanks @VincentTam), I think we should probably take the following approach (but want a second opinion before I start):

  1. SCSS should be processed (as completed in Fixed intro section overlap & Hugo native SCSS #57)
  2. All CSS and JS files should be bundle with like-kinds.
  3. These two bundles should be minified
  4. These two minified bundles should be fingerprinted.
  5. The option enableCDN should default to false.

I don't think I missed anything, but this should really optimize everything.

@pacollins pacollins modified the milestones: 1.2.0, 1.1.0 Aug 22, 2019
@pacollins
Copy link
Owner Author

TODO:

  • Proper FontAwesome local integration
  • Replace 3rd party minified files with non-minified files (just in case someone wants to browse)
  • Add staticman.js

@pacollins pacollins changed the title Remove CDN to match Theme Submission Guidelines WIP: Remove CDN to match Theme Submission Guidelines Aug 23, 2019
@pacollins pacollins mentioned this pull request Aug 23, 2019
7 tasks
@pacollins pacollins changed the title WIP: Remove CDN to match Theme Submission Guidelines Remove CDN to match Theme Submission Guidelines Aug 24, 2019
@pacollins
Copy link
Owner Author

I am missing Staticman files and when I have tried to rebase it has been kinda wonky. I'll let you look first. I think that is the only thing missing from this PR.

Copy link
Collaborator

@VincentTam VincentTam left a comment

Choose a reason for hiding this comment

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

I'm working on the slices to get Staticman JS bundled with other assets.

layouts/partials/head.html Outdated Show resolved Hide resolved
layouts/partials/head.html Outdated Show resolved Hide resolved
layouts/partials/scripts.html Outdated Show resolved Hide resolved
layouts/partials/scripts.html Outdated Show resolved Hide resolved
@VincentTam
Copy link
Collaborator

Test results:

  1. ✔️ Staticman script has worked.

    Screenshot from 2019-08-24 16-54-06

  2. ❌ 404 errors

    Screenshot from 2019-08-24 17-05-23

@VincentTam
Copy link
Collaborator

I am missing Staticman files and when I have tried to rebase it has been kinda wonky. I'll let you look first. I think that is the only thing missing from this PR.

Since we have resources in the form of slices, the append method can be used. Besides, I've condensed the loading of CSS assets by resources.Match "css/*.css".

@pacollins
Copy link
Owner Author

Curious your thoughts on having all the HLJS themes locally. Should we do that, or should we just keep that as a cdn thing (maybe keep default included)?

@VincentTam
Copy link
Collaborator

VincentTam commented Aug 24, 2019

Let's keep them.
Edited: given that the themes are already under assets/css/styles/*.css, let's keep those CSS files.

layouts/partials/head.html Outdated Show resolved Hide resolved
{{ $js := $jsSlice | resources.Concat "js/localbundle.js" | resources.Minify | resources.Fingerprint }}
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}">
{{ else }}
<script src="{{ . | relURL }}"></script>
Copy link
Owner Author

Choose a reason for hiding this comment

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

add-on.js is still dropped unless it is included in .Site.Params.jsFiles.

Copy link
Collaborator

Choose a reason for hiding this comment

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

added back in site config file

@pacollins pacollins mentioned this pull request Nov 5, 2019
6 tasks
@pacollins
Copy link
Owner Author

Hey @VincentTam - I know you have been just as busy as me (I am just jumping in to clean up some issues and PRs). Any chance life has slowed down enough for you to finish? If not I can.

pacollins referenced this pull request in pcolazurdo/hugo-future-imperfect-slim Feb 22, 2020
@pacollins
Copy link
Owner Author

I believe those adjustments complete this PR.

@pacollins
Copy link
Owner Author

With CDN, there seems to be an odd thing happening with the NavBar Title Text. Can't track down the cause.

@pacollins pacollins merged commit 506e066 into master Feb 29, 2020
@pacollins pacollins deleted the remove-cdn branch February 29, 2020 03:40
@pacollins pacollins mentioned this pull request Mar 13, 2020
7 tasks
@pacollins pacollins mentioned this pull request May 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FEATURE: Remove references to third-party CDNs from site head
3 participants