Skip to content

Commit

Permalink
fix(@dpc-sdp/nuxt-ripple): 🐛 move favicon generate to before build
Browse files Browse the repository at this point in the history
  • Loading branch information
dylankelly committed Nov 9, 2023
1 parent 9f33f2d commit 869482b
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/nuxt-ripple/modules/generate-favicon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createResolver, defineNuxtModule } from 'nuxt/kit'
import { createResolver, defineNuxtModule, loadNuxtConfig } from 'nuxt/kit'
import { generate } from './../lib/generate'
import * as jsonapiParse from 'jsonapi-parse'
import fs from 'fs'
Expand All @@ -11,16 +11,16 @@ export default defineNuxtModule({
name: 'generateFavicon'
},
hooks: {
ready: async (nuxtApp) => {
'modules:done': async () => {
const faviconApiKey = process.env.RFG_API_KEY

// Exit early if API key is not set
if (faviconApiKey === undefined) {
console.info('Favicon: missing RFG_API_KEY, skipping')
return
}

const publicFolderPath = nuxtApp.options.alias.public
const nuxtConfig = await loadNuxtConfig({})
const publicFolderPath = nuxtConfig.alias.public

// 1. Check if asset already exists
if (fs.existsSync(`${publicFolderPath}/favicon.ico`)) {
Expand All @@ -30,7 +30,7 @@ export default defineNuxtModule({

// 2. Fetch theme and master asset url from site taxonomy
const siteTaxonomyRes = await fetch(
`${nuxtApp.options.runtimeConfig.public.tide.baseUrl}/api/v1/taxonomy_term/sites?filter%5Bdrupal_internal__tid%5D=${nuxtApp.options.runtimeConfig.public.tide.site}&site=${nuxtApp.options.runtimeConfig.public.tide.site}&include=field_site_favicon`
`${nuxtConfig.runtimeConfig.public.tide.baseUrl}/api/v1/taxonomy_term/sites?filter%5Bdrupal_internal__tid%5D=${nuxtConfig.runtimeConfig.public.tide.site}&site=${nuxtConfig.runtimeConfig.public.tide.site}&include=field_site_favicon`
),
siteTaxonomyData = await siteTaxonomyRes.json(),
parsedData = jsonapiParse.parse(siteTaxonomyData).data[0]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/nuxt-ripple/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions packages/nuxt-ripple/public/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#0054c9</TileColor>
</tile>
</msapplication>
</browserconfig>
Binary file added packages/nuxt-ripple/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/nuxt-ripple/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/nuxt-ripple/public/favicon.ico
Binary file not shown.
Binary file added packages/nuxt-ripple/public/mstile-150x150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions packages/nuxt-ripple/public/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions packages/nuxt-ripple/public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}

0 comments on commit 869482b

Please sign in to comment.