Skip to content

Commit

Permalink
try fix netlify images
Browse files Browse the repository at this point in the history
  • Loading branch information
djay committed Nov 21, 2024
1 parent 5146e95 commit 7ffd694
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 51 deletions.
4 changes: 2 additions & 2 deletions examples/nuxt-blog-starter/composables/imageProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function imageProps(block) {
return {url:null}
}
image_url = image_url.startsWith("/") ? `https://hydra-api.pretagov.com${image_url}`: image_url;
//image_url = image.url.replace("https://hydra-api.pretagov.com/", "/plone/"); // nuxt image alias
//image_url = image.url.replace("https://hydra-api.pretagov.com", "/_plone_"); // nuxt image alias
var srcset = "";
var sizes = "";
var width = block?.width;
Expand Down Expand Up @@ -81,7 +81,7 @@ export default function imageProps(block) {
align: align,
srcset: srcset,
sizes: sizes,
bg: `bg-[url('${image_url}')]`,
//bg: `bg-[url('${image_url}')]`,
width: width,
// ...optimizeImage(
// image_url,
Expand Down
2 changes: 2 additions & 0 deletions examples/nuxt-blog-starter/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[images]
remote_images = ["https://hydra-api.pretagov.com/.*"]
64 changes: 15 additions & 49 deletions examples/nuxt-blog-starter/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,18 @@ export default defineNuxtConfig({
'nuxt-security',
'@nuxt/image'
],
devtools: { enabled: true },
ssr: true,
ssr: true, // "npm run generate" == SSG
routeRules: {
"/**": { cors: true } // public site can't be edited
},
$env: {
edit: {
ssr: false,
generate: {
fallback: "index.html", // Uses '404.html' instead of the default '200.html'
},
ssr: false, // "npm run generate -- --envName edit" == SPA
routeRules: {
"/**": {
cors: true,
// redirect: {
// to: "/index.html",
// statusCode: 200
// },
security: {
// corsHandler: {
// // options
// origin: "https://hydra.pretagov.com"
// },
headers: {
headers: { // Edit site can be put in an iframe
contentSecurityPolicy: {
'img-src': ['self', 'data:', 'https://hydra.pretagov.com', 'https://hydra-api.pretagov.com'],
'connect-src': ["'self'", 'data:', 'https://hydra.pretagov.com', 'https://hydra-api.pretagov.com'],
Expand All @@ -37,51 +28,26 @@ export default defineNuxtConfig({
}
}
}
}
}
},
routeRules: {
"/**": {
cors: true
},
// generate: {
// fallback: "index.html", // Uses '404.html' instead of the default '200.html'
// },
}
// "/_ipx/_/https%3A//*": {
// redirect: {
// to: "/_ipx/_/https%3A/*",
// statusCode: 200
// }
// }
},
// security: {
// corsHandler: {
// // options
// origin: "https://hydra.pretagov.com"
// },
// headers: {
// contentSecurityPolicy: {
// 'img-src': ["'self'", 'data:', 'https://hydra.pretagov.com', 'https://hydra-api.pretagov.com'],
// 'connect-src': ["'self'", 'data:', 'https://hydra.pretagov.com', 'https://hydra-api.pretagov.com'],
// 'frame-ancestors': ['*']
// },
// crossOriginResourcePolicy: "cross-origin",
// }
// },
css: ['/assets/css/main.css'],
devtools: { enabled: true },
// postcss: {
// plugins: {
// tailwindcss: {},
// autoprefixer: {},
// },
// },
image: {
provider: 'ipx',
//provider: 'ipx',
domains: ['hydra-api.pretagov.com'],
// staticFilename: '[publicPath]/images/[name]-[hash][ext]',
// modifiers: {
// quality: 80
// },
alias: {
plone: "https://hydra-api.pretagov.com"
}
// alias: {
// _plone_: "https://hydra-api.pretagov.com"
// }
},
experimental: {
payloadExtraction: false
Expand Down

0 comments on commit 7ffd694

Please sign in to comment.