-
Notifications
You must be signed in to change notification settings - Fork 492
Add script import option #952
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
Open
wherewhere
wants to merge
8
commits into
next-theme:master
Choose a base branch
from
wherewhere:script-option
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b469f42
Add options for next_vendors
wherewhere 679b07f
Set all defer manually
wherewhere d38bdb5
Treat every script load by next_js as user scripts
wherewhere 712c78d
Set the dependences of defer script defer
wherewhere 71f5160
Add warn when defer and async both true
wherewhere 18dbb8e
Set scripts which need page:loaded event to defer
wherewhere 9564b7a
Set defer to false if async is true
wherewhere 76a9671
Add defer or async for some next_vendors
wherewhere File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| <div class="event-list"> | ||
| </div> | ||
| {{- next_js('schedule.js', { pjax: true }) }} | ||
| {{- next_js('schedule.js', { pjax: true, async: true }) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| {%- include 'vendors.njk' -%} | ||
|
|
||
| {%- if theme.injects.comment.length > 1 %} | ||
| {{- next_js('comments.js') }} | ||
| {{- next_js('comments.js', { defer: true }) }} | ||
| {%- endif %} | ||
|
|
||
| {{- next_js('utils.js') }} | ||
| {{- next_js('utils.js', { defer: true }) }} | ||
| {%- if theme.motion.enable %} | ||
| {{- next_js('motion.js') }} | ||
| {{- next_js('motion.js', { defer: true }) }} | ||
| {%- endif %} | ||
|
|
||
| {%- if theme.sidebar.display !== 'remove' %} | ||
| {{- next_js('sidebar.js') }} | ||
| {{- next_js('sidebar.js', { defer: true }) }} | ||
| {%- endif %} | ||
|
|
||
| {{- next_js('next-boot.js') }} | ||
| {{- next_js('next-boot.js', { defer: true }) }} | ||
| {%- if theme.bookmark.enable %} | ||
| {{- next_js('bookmark.js') }} | ||
| {{- next_js('bookmark.js', { defer: true }) }} | ||
| {%- endif %} | ||
| {%- if theme.pjax %} | ||
| {{- next_js('pjax.js') }} | ||
| {{- next_js('pjax.js', { defer: true }) }} | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| {%- if theme.addtoany.enable %} | ||
| {{ next_js('third-party/addtoany.js') }} | ||
| {{ next_js('third-party/addtoany.js', { defer: true }) }} | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| {%- if theme.baidu_analytics %} | ||
| {{ next_js('third-party/analytics/baidu-analytics.js') }} | ||
| {{ next_js('third-party/analytics/baidu-analytics.js', { async: true }) }} | ||
| <script async src="https://hm.baidu.com/hm.js?{{ theme.baidu_analytics }}"></script> | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| {%- if theme.growingio_analytics %} | ||
| <script async src="//assets.growingio.com/2.1/gio.js"></script> | ||
| {{ next_data('growingio_analytics', theme.growingio_analytics) }} | ||
| {{ next_js('third-party/analytics/growingio.js') }} | ||
| {{ next_js('third-party/analytics/growingio.js', { async: true }) }} | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| {%- if theme.matomo.enable %} | ||
| {{ next_data('matomo', theme.matomo) }} | ||
| {{ next_js('third-party/analytics/matomo.js') }} | ||
| {{ next_js('third-party/analytics/matomo.js', { async: true }) }} | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| {{ next_data('chatra', theme.chatra) }} | ||
| {{ next_js('third-party/chat/chatra.js') }} | ||
| {{ next_js('third-party/chat/chatra.js', { defer: true }) }} | ||
| <script{{ ' async' if theme.chatra.async }} src="https://call.chatra.io/chatra.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| <script src="//code.tidio.co/{{ theme.tidio.key }}.js"></script> | ||
| {{ next_js('third-party/chat/tidio.js') }} | ||
| {{ next_js('third-party/chat/tidio.js', { defer: true }) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| {{ next_data('changyan', theme.changyan) }} | ||
| {{ next_js('third-party/comments/changyan.js') }} | ||
| {{ next_js('third-party/comments/changyan.js', { defer: true }) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| {{ next_data('isso', theme.isso) }} | ||
| {{ next_js('third-party/comments/isso.js') }} | ||
| {{ next_js('third-party/comments/isso.js', { defer: true }) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| {{ next_js('third-party/comments/livere.js') }} | ||
| {{ next_js('third-party/comments/livere.js', { defer: true }) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| {{ next_data('utterances', theme.utterances) }} | ||
| {{ next_js('third-party/comments/utterances.js') }} | ||
| {{ next_js('third-party/comments/utterances.js', { defer: true }) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| {%- if theme.fancybox %} | ||
| {{ next_js('third-party/fancybox.js') }} | ||
| {{ next_js('third-party/fancybox.js', { defer: true }) }} | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| {{ next_vendors('katex') }} | ||
| {{ next_vendors('katex', { defer: true }) }} | ||
| {%- if theme.math.katex.copy_tex %} | ||
| {{ next_data('katex', { | ||
| copy_tex_js: theme.vendors.copy_tex_js | ||
| }) }} | ||
| {{ next_js('third-party/math/katex.js') }} | ||
| {{ next_js('third-party/math/katex.js', { defer: true }) }} | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| {{ next_data('mathjax', theme.math.mathjax, { | ||
| js: theme.vendors.mathjax | ||
| }) }} | ||
| {{ next_js('third-party/math/mathjax.js') }} | ||
| {{ next_js('third-party/math/mathjax.js', { defer: true }) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| {%- if theme.pace.enable %} | ||
| {{ next_js('third-party/pace.js') }} | ||
| {{ next_js('third-party/pace.js', { defer: true }) }} | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| {%- if theme.quicklink.enable %} | ||
| {{ next_vendors('quicklink') }} | ||
| {{ next_vendors('quicklink', { defer: true }) }} | ||
| {{ next_data('quicklink', page.quicklink, { | ||
| url: url | replace(r/index\.html$/, '') | ||
| }) }} | ||
| {{ next_js('third-party/quicklink.js') }} | ||
| {{ next_js('third-party/quicklink.js', { defer: true }) }} | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,2 @@ | ||
| {{ next_vendors('algolia_search') }} | ||
|
|
||
| {{- next_js('third-party/search/algolia-search.js') }} | ||
| {{ next_vendors('algolia_search', { defer: true }) }} | ||
| {{- next_js('third-party/search/algolia-search.js', { defer: true }) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| {{ next_vendors('local_search') }} | ||
| {{ next_js('third-party/search/local-search.js') }} | ||
| {{ next_vendors('local_search', { defer: true }) }} | ||
| {{ next_js('third-party/search/local-search.js', { defer: true }) }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| {%- if theme.firestore.enable %} | ||
| {{ next_vendors('firebase_app') }} | ||
| {{ next_vendors('firebase_firestore') }} | ||
| {{ next_vendors('firebase_app', { defer: true }) }} | ||
| {{ next_vendors('firebase_firestore', { defer: true }) }} | ||
| {{ next_data('firestore', theme.firestore) }} | ||
| {{ next_js('third-party/statistics/firestore.js') }} | ||
| {{ next_js('third-party/statistics/firestore.js', { defer: true }) }} | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| {%- if theme.leancloud_visitors.enable %} | ||
| {{ next_data('leancloud_visitors', theme.leancloud_visitors) }} | ||
| {{ next_js('third-party/statistics/lean-analytics.js') }} | ||
| {{ next_js('third-party/statistics/lean-analytics.js', { defer: true }) }} | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.