Separate javascript into page-specific files and remove unused code #381
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wanted to add an anchor link to the front page, but FAQ page JavaScript was getting in the way.
As it turned out, JavaScript code for the home and FAQ pages was being loaded for every page. This also made load times unnecessarily slower for other pages.
This PR puts JavaScript for the home page in a separate home.js file that is only loaded when the home page is loaded. Likewise for the FAQ page.
Additionally, it removes lingering code from when Google Analytics was used.
Review/test:
https://deploy-preview-381--bisq-website.netlify.app/
Review Guidance
In this case, there are just 2 commits, so it's worth looking at them separately.
sendAnalytic()
function and both lines that call itsendAnalytic()
...since these proposed changes remove that function, that method should not be used anywhere else./js/scripts.js
into 2 separate files called/js/home.js
and/js/faq.js
.git checkout master
,rm -rf _site
, and thenbundle exec jekyll build
._site
folder somewhere else.git checkout move-js
,rm -rf _site
, and thenbundle exec jekyll build
._site
folder with the other one with a diffing tool of your choice (e.g. Meld).You should see
js/scripts.js
missing on every page, andjs/home.js
andjs/faq.js
added to all home pages and all faq pages...but everything else should be the same.