chore: use remote search
This commit is contained in:
parent
7a2a2aa951
commit
482e13569f
53 changed files with 1184 additions and 3735 deletions
87
.eleventy.js
87
.eleventy.js
|
@ -1,59 +1,49 @@
|
|||
import { createRequire } from 'module'
|
||||
import dotenvFlow from 'dotenv-flow'
|
||||
import filters from './config/filters/index.js'
|
||||
import htmlmin from 'html-minifier-terser'
|
||||
import markdownIt from 'markdown-it'
|
||||
import markdownItAnchor from 'markdown-it-anchor'
|
||||
import markdownItFootnote from 'markdown-it-footnote'
|
||||
import markdownItPrism from 'markdown-it-prism'
|
||||
import EleventyVitePlugin from '@11ty/eleventy-plugin-vite'
|
||||
import { ViteMinifyPlugin } from 'vite-plugin-minify'
|
||||
import { resolve } from 'path';
|
||||
import syntaxHighlight from '@11ty/eleventy-plugin-syntaxhighlight'
|
||||
import tablerIcons from '@cdransf/eleventy-plugin-tabler-icons'
|
||||
import { copyErrorPages, minifyJsComponents } from './config/events/index.js'
|
||||
import { albumReleasesCalendar } from './config/collections/index.js'
|
||||
import { cssConfig } from './config/plugins/css-config.js'
|
||||
|
||||
// load .env
|
||||
dotenvFlow.config()
|
||||
|
||||
// get app version
|
||||
const require = createRequire(import.meta.url)
|
||||
const appVersion = require('./package.json').version
|
||||
|
||||
export default async function (eleventyConfig) {
|
||||
eleventyConfig.addPlugin(syntaxHighlight)
|
||||
eleventyConfig.addPlugin(tablerIcons)
|
||||
|
||||
eleventyConfig.addPassthroughCopy('src/assets')
|
||||
eleventyConfig.addPassthroughCopy('_redirects')
|
||||
eleventyConfig.addPassthroughCopy('_headers')
|
||||
|
||||
eleventyConfig.addPlugin(EleventyVitePlugin, {
|
||||
tempFolderName: '.11ty-vite',
|
||||
viteOptions: {
|
||||
clearScreen: false,
|
||||
appType: 'mpa',
|
||||
server: {
|
||||
middlewareMode: true,
|
||||
},
|
||||
assetsInclude: ['src/assets/fonts/*.woff2'],
|
||||
build: {
|
||||
emptyOutDir: true,
|
||||
rollupOptions: {
|
||||
external: ['/js/script.js'],
|
||||
input: {
|
||||
main: resolve('./src/assets/index.js'),
|
||||
},
|
||||
output: {
|
||||
assetFileNames: 'assets/css/[name][extname]',
|
||||
chunkFileNames: 'assets/js/[name].[hash].js',
|
||||
entryFileNames: 'assets/js/[name].[hash].js'
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [ViteMinifyPlugin({})],
|
||||
},
|
||||
})
|
||||
if (process.env.ELEVENTY_PRODUCTION) eleventyConfig.addPlugin(cssConfig)
|
||||
|
||||
eleventyConfig.setServerOptions({ domdiff: false })
|
||||
eleventyConfig.setWatchThrottleWaitTime(200)
|
||||
eleventyConfig.setQuietMode(true)
|
||||
eleventyConfig.configureErrorReporting({ allowMissingExtensions: true })
|
||||
eleventyConfig.setLiquidOptions({ jsTruthy: true })
|
||||
eleventyConfig.setLiquidOptions({
|
||||
jsTruthy: true,
|
||||
})
|
||||
|
||||
eleventyConfig.addPassthroughCopy('src/assets')
|
||||
eleventyConfig.addPassthroughCopy('_redirects')
|
||||
eleventyConfig.addPassthroughCopy('_headers')
|
||||
eleventyConfig.addPassthroughCopy({
|
||||
'node_modules/@cdransf/api-text/api-text.js': 'assets/scripts/components/api-text.js',
|
||||
'node_modules/@cdransf/select-pagination/select-pagination.js': 'assets/scripts/components/select-pagination.js',
|
||||
'node_modules/@cdransf/theme-toggle/theme-toggle.js': 'assets/scripts/components/theme-toggle.js',
|
||||
'node_modules/@daviddarnes/mastodon-post/mastodon-post.js': 'assets/scripts/components/mastodon-post.js',
|
||||
'node_modules/minisearch/dist/umd/index.js': 'assets/scripts/components/minisearch.js',
|
||||
'node_modules/youtube-video-element/youtube-video-element.js': 'assets/scripts/components/youtube-video-element.js'
|
||||
})
|
||||
|
||||
eleventyConfig.addCollection('albumReleasesCalendar', albumReleasesCalendar)
|
||||
|
||||
|
@ -66,7 +56,6 @@ export default async function (eleventyConfig) {
|
|||
})
|
||||
md.use(markdownItFootnote)
|
||||
md.use(markdownItPrism)
|
||||
|
||||
eleventyConfig.setLibrary('md', md)
|
||||
|
||||
eleventyConfig.addLiquidFilter('markdown', (content) => {
|
||||
|
@ -78,6 +67,34 @@ export default async function (eleventyConfig) {
|
|||
eleventyConfig.addLiquidFilter(filterName, filters[filterName])
|
||||
})
|
||||
|
||||
eleventyConfig.addShortcode('appVersion', () => appVersion)
|
||||
|
||||
// events
|
||||
if (process.env.ELEVENTY_PRODUCTION) eleventyConfig.on('afterBuild', copyErrorPages)
|
||||
if (process.env.ELEVENTY_PRODUCTION) eleventyConfig.on('afterBuild', minifyJsComponents)
|
||||
|
||||
// transforms
|
||||
if (process.env.ELEVENTY_PRODUCTION) eleventyConfig.addTransform('html-minify', (content, path) => {
|
||||
if (path && path.endsWith('.html')) {
|
||||
return htmlmin.minify(content, {
|
||||
collapseBooleanAttributes: true,
|
||||
collapseWhitespace: true,
|
||||
decodeEntities: true,
|
||||
includeAutoGeneratedTags: false,
|
||||
minifyCSS: true,
|
||||
minifyJS: true,
|
||||
minifyURLs: true,
|
||||
noNewlinesBeforeTagClose: true,
|
||||
quoteCharacter: '"',
|
||||
removeComments: true,
|
||||
sortAttributes: true,
|
||||
sortClassName: true,
|
||||
useShortDoctype: true,
|
||||
})
|
||||
}
|
||||
return content
|
||||
})
|
||||
|
||||
return {
|
||||
passthroughFileCopy: true,
|
||||
dir: {
|
||||
|
|
Reference in a new issue