Tim
Tim
Explore posts from servers
NNuxt
Created by Tim on 4/12/2024 in #❓・help
Nuxt 2: Exclude route from router magic
Im working on upgrading a project from nuxt 2 to nuxt 3. But because the nuxt 2 project is being used daily we decided to keep the nuxt 2 project running until everything has been ported to nuxt 3. So when we build nuxt 2 it builds to “../wwwroot” (.NET) We also made that if we run the nuxt 3 project it builds to “../wwwroot/next” With the idea that on / it will show us the nuxt 2 project and on /next it will show us the nuxt 3 project. However. Currently the router of nuxt 2 is blocking access to /next since it’s not a known page by the router. How do we fix this?
2 replies
NNuxt
Created by Tim on 7/25/2023 in #❓・help
what is the right way to use functions from js file?
Hi, Im using grained.js which is supplied from a grained.js file, I have the file imported through my head in my nuxt.config.ts, However whenever I want to use the grained function nuxt almost always returns a 500 error. What am I doing wrong here?
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: ['@nuxtjs/tailwindcss'],
app: {
head: {
meta: [
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
],
script: [
{ src: '/grained.js' }
],
noscript: [
{ innerHTML: 'This website requires JavaScript.' }
],
}
}
});
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: ['@nuxtjs/tailwindcss'],
app: {
head: {
meta: [
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
],
script: [
{ src: '/grained.js' }
],
noscript: [
{ innerHTML: 'This website requires JavaScript.' }
],
}
}
});
<script>

grained('#grain', {
animate: true,
patternWidth: 100,
patternHeight: 100,
grainOpacity: 0.1,
grainDensity: 1,
grainWidth: 1,
grainHeight: 1
});

export default {
name: 'App',
}

</script
<script>

grained('#grain', {
animate: true,
patternWidth: 100,
patternHeight: 100,
grainOpacity: 0.1,
grainDensity: 1,
grainWidth: 1,
grainHeight: 1
});

export default {
name: 'App',
}

</script
grained.js: https://github.com/sarathsaleem/grained/blob/master/grained.js
5 replies