Add turbolinks

This commit is contained in:
Oliver Davies 2020-03-14 18:57:33 +00:00
parent d2858c6315
commit 51595b6c6d
4 changed files with 15 additions and 5 deletions

View file

@ -1,8 +1,11 @@
import 'alpinejs' import 'alpinejs'
import '../css/app.pcss' import '../css/app.pcss'
import turbolinks from 'turbolinks'
window.hljs = require('highlightjs') window.hljs = require('highlightjs')
let html = document.documentElement let html = document.documentElement
html.classList.remove('no-js') html.classList.remove('no-js')
html.classList.add('js') html.classList.add('js')
turbolinks.start()

11
package-lock.json generated
View file

@ -1053,9 +1053,9 @@
}, },
"dependencies": { "dependencies": {
"acorn": { "acorn": {
"version": "7.1.0", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==" "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg=="
} }
} }
}, },
@ -8607,6 +8607,11 @@
"resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
"integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=" "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY="
}, },
"turbolinks": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/turbolinks/-/turbolinks-5.2.0.tgz",
"integrity": "sha512-pMiez3tyBo6uRHFNNZoYMmrES/IaGgMhQQM+VFF36keryjb5ms0XkVpmKHkfW/4Vy96qiGW3K9bz0tF5sK9bBw=="
},
"type": { "type": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",

View file

@ -19,7 +19,8 @@
"tailwindcss-interaction-variants": "^2.2.0", "tailwindcss-interaction-variants": "^2.2.0",
"tailwindcss-skip-link": "^1.0.1", "tailwindcss-skip-link": "^1.0.1",
"tailwindcss-spaced-items": "^0.1.0", "tailwindcss-spaced-items": "^0.1.0",
"tailwindcss-visuallyhidden": "^1.0.2" "tailwindcss-visuallyhidden": "^1.0.2",
"turbolinks": "^5.2.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^5.15.3", "eslint": "^5.15.3",

View file

@ -12,12 +12,13 @@ Encore
.configureLoaderRule('css', loaderRule => { .configureLoaderRule('css', loaderRule => {
loaderRule.test = /\.(css|p(ost)?css)$/ loaderRule.test = /\.(css|p(ost)?css)$/
}) })
.enableSourceMaps(!Encore.isProduction())
if (Encore.isProduction()) { if (Encore.isProduction()) {
Encore Encore
.enableVersioning() .enableVersioning()
.addPlugin(new PurgecssPlugin(purgecssConfig)) .addPlugin(new PurgecssPlugin(purgecssConfig))
} else {
Encore.enableSourceMaps()
} }
module.exports = Encore.getWebpackConfig() module.exports = Encore.getWebpackConfig()