mirror of
https://github.com/cupcakearmy/liquet.git
synced 2024-12-22 08:06:24 +00:00
preloading
This commit is contained in:
parent
179d718a39
commit
80f048de3a
38
.drone.yml
38
.drone.yml
@ -8,22 +8,22 @@ steps:
|
||||
commands:
|
||||
- node -v
|
||||
- pnpm --shamefully-flatten i
|
||||
- pnpm run build:prod
|
||||
#
|
||||
#
|
||||
# - name: deploy
|
||||
# image: cupcakearmy/drone-deploy
|
||||
# pull: always
|
||||
# environment:
|
||||
# PLUGIN_KEY:
|
||||
# from_secret: ssh_key
|
||||
# settings:
|
||||
# host: srv-0.nicco.io
|
||||
# user: root
|
||||
# port: 1312
|
||||
# target: /srv/web/blog
|
||||
# sources:
|
||||
# - ./liquet
|
||||
# when:
|
||||
# event: push
|
||||
# branch: master
|
||||
- pnpm run build
|
||||
|
||||
|
||||
- name: deploy
|
||||
image: cupcakearmy/drone-deploy
|
||||
pull: always
|
||||
environment:
|
||||
PLUGIN_KEY:
|
||||
from_secret: ssh_key
|
||||
settings:
|
||||
host: srv-0.nicco.io
|
||||
user: root
|
||||
port: 1312
|
||||
target: /srv/web/blog
|
||||
sources:
|
||||
- ./liquet
|
||||
when:
|
||||
event: push
|
||||
branch: master
|
@ -5,6 +5,7 @@
|
||||
"build": "parcel build --no-source-maps -d liquet/dist ./src/js/index.js ./src/styles/index.styl"
|
||||
},
|
||||
"dependencies": {
|
||||
"@swup/preload-plugin": "^1.0.3",
|
||||
"jquery": "^3.4.1",
|
||||
"swup": "^2.0.7"
|
||||
},
|
||||
|
@ -1,2 +1,11 @@
|
||||
import './lights'
|
||||
import './lazy'
|
||||
import lights from './lights'
|
||||
import lazy from './lazy'
|
||||
import swup from './swup'
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
lights()
|
||||
lazy()
|
||||
swup(()=> {
|
||||
lazy()
|
||||
})
|
||||
})
|
@ -1,6 +1,6 @@
|
||||
import jQuery from 'jquery'
|
||||
import $ from 'jquery'
|
||||
|
||||
jQuery(($) => {
|
||||
export default () => {
|
||||
const bottomOffset = 300
|
||||
const app = document.getElementById('app')
|
||||
let loading = false
|
||||
@ -35,4 +35,4 @@ jQuery(($) => {
|
||||
|
||||
// Check initial page if they need loading
|
||||
load.bind(app)()
|
||||
})
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
;((window) => {
|
||||
export default () => {
|
||||
// Lights
|
||||
const key = 'nicco.io:blog:lights'
|
||||
const CSS = 'body, .wp-block-image img, .thumbnail img {filter: invert(1);} '
|
||||
@ -27,4 +27,4 @@
|
||||
toFocus.tabIndex = '1'
|
||||
toFocus.focus({preventScroll: true})
|
||||
})
|
||||
})(window)
|
||||
}
|
11
src/js/swup.js
Normal file
11
src/js/swup.js
Normal file
@ -0,0 +1,11 @@
|
||||
import Swup from 'swup'
|
||||
import SwupPreloadPlugin from '@swup/preload-plugin';
|
||||
|
||||
export default (fn) => {
|
||||
const swup = new Swup({
|
||||
plugins: [new SwupPreloadPlugin()],
|
||||
containers: ['#app']
|
||||
})
|
||||
|
||||
swup.on('contentReplaced', fn)
|
||||
}
|
Loading…
Reference in New Issue
Block a user