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

Allow delayed loading of three.js #935

Merged
merged 3 commits into from
Jul 10, 2019
Merged

Allow delayed loading of three.js #935

merged 3 commits into from
Jul 10, 2019

Conversation

1v9
Copy link
Member

@1v9 1v9 commented Jun 28, 2019

See #932

@1v9 1v9 added this to the v7.2.0 milestone Jun 28, 2019
@1v9
Copy link
Member Author

1v9 commented Jun 28, 2019

In fact I have seen too much blogs based on Github Pages enable features like three.js and they all sucks because the network condition between Github CDN and China is a mess.

To avoid blocking render, I thought of three ways:

  • use hexo filter to operate DOM and put <script> in the bottom.

  • modify the position of <script> in our swig template.

  • use JavaScript, like this PR.

Surely this PR is not good enough, for wider use maybe hexo filter is best.

@jiangtj
Copy link
Member

jiangtj commented Jul 3, 2019

@1v9
Copy link
Member Author

1v9 commented Jul 3, 2019

@jiangtj

Yeah that's another method (before Domcontentloaded) but async is wrong.

<script defer src="/path/to/three.min.js"></script>
<script defer src="/path/to/three-waves.min.js"></script>

@stevenjoezhang stevenjoezhang modified the milestones: v7.2.0, v7.3.0 Jul 3, 2019
@1v9 1v9 marked this pull request as ready for review July 8, 2019 11:21
@1v9
Copy link
Member Author

1v9 commented Jul 8, 2019

{% include '_scripts/three.swig' %} or {% include '_third-party/three.swig' %} or other position?

@1v9 1v9 merged commit 0e7f19f into master Jul 10, 2019
@delete-merged-branch delete-merged-branch bot deleted the three branch July 10, 2019 15:29
tongluyang pushed a commit to tongluyang/hexo-theme-next that referenced this pull request Nov 19, 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.

3 participants