mirror of
https://github.com/hyprwm/hyprland-website.git
synced 2024-12-22 02:19:47 +01:00
Small stuff (#69)
* refactor Title refactor title component * featureSlice: nicer max-width * add meta title to news * plugins as toml, no plugin sub-pages fixup toml * plugins: better letter if no icon present * add more plugins to showcase * fix blur script
This commit is contained in:
parent
33ae9677a1
commit
4795b5d761
2 changed files with 22 additions and 23 deletions
|
@ -21,17 +21,23 @@ const filePaths = await globby(imageDirectories, {
|
|||
extensions: ['svg', 'webp', 'jpg', 'png', 'gif', 'bmp', 'jpeg']
|
||||
},
|
||||
gitignore: false
|
||||
}).then((filePaths) => {
|
||||
const fileNames = filePaths.map(getFileNameWithoutExtension)
|
||||
}).then((filePaths) =>
|
||||
filePaths
|
||||
.filter((filePath) => {
|
||||
const isGenerated = getFileNameWithoutExtension(filePath).startsWith(generatedPrefix)
|
||||
|
||||
return filePaths
|
||||
.filter(
|
||||
(file) =>
|
||||
!getFileNameWithoutExtension(file).startsWith(generatedPrefix) &&
|
||||
!fileNames.includes(generatedPrefix + getFileNameWithoutExtension(file))
|
||||
)
|
||||
if (isGenerated) return false
|
||||
|
||||
const fileName = getFileNameWithoutExtension(filePath)
|
||||
const fileDirectory = filePath.split('/').slice(0, -2).join('/') + '/'
|
||||
const generatedFilePath = `${fileDirectory}${generatedPrefix}${fileName}.webp`
|
||||
|
||||
const isAlreadyBlurred = filePaths.includes(generatedFilePath)
|
||||
|
||||
return !isAlreadyBlurred
|
||||
})
|
||||
.map((filePath) => new URL(filePath, root))
|
||||
})
|
||||
)
|
||||
|
||||
for (const filePathUrl of filePaths) {
|
||||
const extension = filePathUrl.pathname.split('.').at(-1)
|
||||
|
|
|
@ -2,23 +2,16 @@ import { json } from '@sveltejs/kit'
|
|||
import path from 'path'
|
||||
import { parse } from 'smol-toml'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import pluginsToml from '../../../content/plugins.toml?raw'
|
||||
|
||||
/** Get the plugins of the `content/plugins/` directory */
|
||||
async function getPlugins() {
|
||||
const plugins = await readFile(
|
||||
path.join(import.meta.dirname, '../../../content/plugins.toml'),
|
||||
'utf-8'
|
||||
const plugins = parse(pluginsToml).plugins.sort(
|
||||
(a, b) =>
|
||||
(b.featured ?? 0) - (a.featured ?? 0) ||
|
||||
(b.weight ?? 0) - (a.weight ?? 0) ||
|
||||
((b.logo && 1) ?? 0) - ((a.logo && 1) ?? 0) ||
|
||||
((b.banner && 1) ?? 0) - ((a.banner && 1) ?? 0)
|
||||
)
|
||||
.then(parse)
|
||||
.then(({ plugins }) =>
|
||||
plugins.sort(
|
||||
(a, b) =>
|
||||
(b.featured ?? 0) - (a.featured ?? 0) ||
|
||||
(b.weight ?? 0) - (a.weight ?? 0) ||
|
||||
((b.logo && 1) ?? 0) - ((a.logo && 1) ?? 0) ||
|
||||
((b.banner && 1) ?? 0) - ((a.banner && 1) ?? 0)
|
||||
)
|
||||
)
|
||||
|
||||
return plugins
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue