Skip to content

Commit

Permalink
feat: add preloader to page layout and optimize script placement
Browse files Browse the repository at this point in the history
- Added preloader to page layout if enabled in theme settings
- Moved anime.js script to head partial for better loading optimization
- Removed redundant script rendering from preloader partial
  • Loading branch information
EvanNotFound committed Jun 17, 2024
1 parent beaa9ac commit 91b74b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 3 additions & 4 deletions layout/_partials/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@
<% } }%>
<% } }%>

<% if (theme.global.preloader) { %>
<%- partial('_partials/preloader') %>
<% } %>

<%- css('css/style') %>

<% if (theme.developer && theme.developer.enable) {%>
Expand All @@ -115,6 +111,9 @@
<link href="<%- theme.global.fonts.english.url %>" rel="stylesheet">
<% } %>

<% if (theme.global.preloader) { %>
<%- renderJS('js/libs/anime.min.js')%>
<% } %>

<%- export_config() %>

Expand Down
1 change: 0 additions & 1 deletion layout/_partials/preloader.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
</style>

<div class="preloader">
<%- renderJS('js/libs/anime.min.js')%>
<h2 class="ml13">
<%= theme.info.title %>
</h2>
Expand Down
3 changes: 3 additions & 0 deletions layout/page.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<%- partial('_widgets/progress-bar') %>
<% if (theme.global.preloader) { %>
<%- partial('_partials/preloader') %>
<% } %>
<main class="page-container" id="swup">

<% if (theme.home_banner.enable === true && is_home() && !page.prev) { %>
Expand Down

0 comments on commit 91b74b6

Please sign in to comment.