N
Nuxt4mo ago
oemer

Can you define a page completely separately from the rest (no plugins, no middlewares etc)?

It is an emendable iframe that is defined as public page on my nuxt app. It doesn't need all the plugins, like auth, middlewares and so on. To speed the loading time there.
2 Replies
kapa.ai
kapa.ai4mo ago
Hi @oemer. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, you can define a page separately from the rest of your Nuxt application, including excluding plugins, middlewares, and other features. This can be achieved using the public directory in Nuxt 3. Here's how you can do it: 1. Place your standalone HTML page in the public directory of your Nuxt project. For example:
/public/html/standalone-page/index.html
/public/html/standalone-page/index.html
2. This page will be accessible at /html/standalone-page/index.html or /html/standalone-page/ in your browser. 3. In your standalone HTML file, you can include your own CSS, JavaScript (including jQuery if needed), and images without relying on Nuxt's features. Here's an example of how your standalone HTML file might look:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Standalone Page</title>
<link rel="stylesheet" href="/html/standalone-page/style.css">
<script src="<https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>>
</head>
<body>
<div>
Hello World
</div>
<script src="/html/standalone-page/script.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Standalone Page</title>
<link rel="stylesheet" href="/html/standalone-page/style.css">
<script src="<https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>>
</head>
<body>
<div>
Hello World
</div>
<script src="/html/standalone-page/script.js"></script>
</body>
</html>
This approach allows you to create a completely separate page that doesn't use any of Nuxt's features, plugins, or middlewares, which can help improve loading times for this specific page. Stack Overflow: Place a separate subproject in the Nuxt 3 project (https://stackoverflow.com/questions/76936168) Remember that this page will be served as a static file and won't have access to Nuxt's server-side rendering or other Nuxt-specific features. It's ideal for simple, standalone pages or embeddable iframes that don't require the full Nuxt functionality. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4mo ago
<@1093197930996961411> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?