Movatterモバイル変換


[0]ホーム

URL:


Wayback Machine
25 captures
30 Sep 2021 - 22 Mar 2023
FebMARApr
22
202220232024
success
fail
COLLECTED BY
Collection:Common Crawl
Web crawl data from Common Crawl.
TIMESTAMPS
loading
The Wayback Machine - http://web.archive.org/web/20230322022345/https://nuxtjs.org/docs/directory-structure/static/

You are reading Nuxt 2 docs. Head overnuxt.com for Nuxt 3 docs.

Static directory

The static directory is directly mapped to the server root () and contains files that likely won't be changed. All included files will be automatically served by Nuxt and are accessible through your project root URL.


/static/robots.txt will be available athttp://localhost:3000/robots.txt

/static/favicon.ico will be available at  http://localhost:3000/favicon.ico

This option is helpful for files like robots.txtsitemap.xml or CNAME (which is important for GitHub Pages deployment).

This directory cannot be renamed without extra configuration.

Static Assets

If you don't want to use Webpack assets from the assets directory, you can add the images to the static directory.

In your code, you can then reference these files relative to the root (/):

<!-- Static image from static directory --><imgsrc="/my-image.png"/><!-- webpacked image from assets directory --><imgsrc="~/assets/my-image-2.png"/>
Nuxt doesn't change this path, so if you customize yourrouter.base then you'll need to make sure to add that manually to your paths. For example:
<img:src="`${yourPrefix}/my-image.png`"/>

Static Directory Config

Should you need to you can configure thestatic/ directory behavior in thenuxt.config.js file.

Static asset Prefix

If you deploy Nuxt to a subfolder, e.g./blog/, the router base will be added to the static asset path by default. If you want to disable this behavior, you can setstatic.prefix to false in thenuxt.config.js.

exportdefault{static:{    prefix:false}}

Default:/blog/my-image.png

Withstatic.prefix disabled:/my-image.png



[8]ページ先頭

©2009-2025 Movatter.jp