Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Post Timeline

edited body
Source Link
xubeiyan
  • 205
  • 3
  • 12

TLTL;DR:DR;

move out the upload image folder from static folder

because static folder will be complied by copying its contain files to build/client, and do somthing others

and Svelte tutorial in this page, said about static folder

Any static assets that should be served as-is

So I think should not place dynamic, user generate content here

Project Structure

before

├ src
├ static
│ ├ images
│ │ └ (upload images here)
│ ├ favicon.svg
│ └ (other static files)
├ (other files)

after

├ src
├ static
│ ├ favicon.svg
│ └ (other static files)
├ uploadImages // new place, not only here, but also other place you can access
│ └ (upload images here)
├ (other files)

in this way, we can achieve many things:

  1. there is no difference between dev and other mode
  2. we can make a configuation in .env file to select other folder
  3. it can also handle by web server software, like nginx, if I put it in like /opt/anonymous_board/upload_images, there is no need to serve the images by Node.js

TL:DR;

move out the upload image folder from static folder

because static folder will be complied by copying its contain files to build/client, and do somthing others

and Svelte tutorial in this page, said about static folder

Any static assets that should be served as-is

So I think should not place dynamic, user generate content here

Project Structure

before

├ src
├ static
│ ├ images
│ │ └ (upload images here)
│ ├ favicon.svg
│ └ (other static files)
├ (other files)

after

├ src
├ static
│ ├ favicon.svg
│ └ (other static files)
├ uploadImages // new place, not only here, but also other place you can access
│ └ (upload images here)
├ (other files)

in this way, we can achieve many things:

  1. there is no difference between dev and other mode
  2. we can make a configuation in .env file to select other folder
  3. it can also handle by web server software, like nginx, if I put it in like /opt/anonymous_board/upload_images, there is no need to serve the images by Node.js

TL;DR:

move out the upload image folder from static folder

because static folder will be complied by copying its contain files to build/client, and do somthing others

and Svelte tutorial in this page, said about static folder

Any static assets that should be served as-is

So I think should not place dynamic, user generate content here

Project Structure

before

├ src
├ static
│ ├ images
│ │ └ (upload images here)
│ ├ favicon.svg
│ └ (other static files)
├ (other files)

after

├ src
├ static
│ ├ favicon.svg
│ └ (other static files)
├ uploadImages // new place, not only here, but also other place you can access
│ └ (upload images here)
├ (other files)

in this way, we can achieve many things:

  1. there is no difference between dev and other mode
  2. we can make a configuation in .env file to select other folder
  3. it can also handle by web server software, like nginx, if I put it in like /opt/anonymous_board/upload_images, there is no need to serve the images by Node.js
add svelte docs reference
Source Link
xubeiyan
  • 205
  • 3
  • 12

My solution

TL:DR;

move out the upload image folder from static folder

because static folder will be complied by copying its contain files to build/client, and do somthing others

and Svelte tutorial in this page , said about static folder

Any static assets that should be served as-is

So I think should not place dynamic, user generate content here

Project Structure

before

├ src
├ static
│ ├ images
│ │ └ (upload images here)
│ ├ favicon.svg
│ └ (other static files)
├ (other files)

after

├ src
├ static
│ ├ favicon.svg
│ └ (other static files)
├ uploadImages // new place, not only here, but also other place you can access
│ └ (upload images here)
├ (other files)

in this way, we can achieve many things:

  1. there is no difference between dev and other mode
  2. we can make a configuation in .env file to select other folder
  3. it can also handle by web server software, like nginx, if I put it in like /opt/anonymous_board/upload_images, there is no need to serve the images by Node.js

My solution

TL:DR;

move out the upload image folder from static folder

because static folder will be complied by copying its contain files to build/client, and do somthing others

Project Structure

before

├ src
├ static
│ ├ images
│ │ └ (upload images here)
│ ├ favicon.svg
│ └ (other static files)
├ (other files)

after

├ src
├ static
│ ├ favicon.svg
│ └ (other static files)
├ uploadImages // new place, not only here
│ └ (upload images here)
├ (other files)

in this way, we can achieve many things:

  1. there is no difference between dev and other mode
  2. we can make a configuation in .env file to select other folder
  3. it can also handle by web server software, like nginx, if I put it in like /opt/anonymous_board/upload_images, there is no need to serve the images by Node.js

TL:DR;

move out the upload image folder from static folder

because static folder will be complied by copying its contain files to build/client, and do somthing others

and Svelte tutorial in this page , said about static folder

Any static assets that should be served as-is

So I think should not place dynamic, user generate content here

Project Structure

before

├ src
├ static
│ ├ images
│ │ └ (upload images here)
│ ├ favicon.svg
│ └ (other static files)
├ (other files)

after

├ src
├ static
│ ├ favicon.svg
│ └ (other static files)
├ uploadImages // new place, not only here, but also other place you can access
│ └ (upload images here)
├ (other files)

in this way, we can achieve many things:

  1. there is no difference between dev and other mode
  2. we can make a configuation in .env file to select other folder
  3. it can also handle by web server software, like nginx, if I put it in like /opt/anonymous_board/upload_images, there is no need to serve the images by Node.js
Source Link
xubeiyan
  • 205
  • 3
  • 12

My solution

TL:DR;

move out the upload image folder from static folder

because static folder will be complied by copying its contain files to build/client, and do somthing others

Project Structure

before

├ src
├ static
│ ├ images
│ │ └ (upload images here)
│ ├ favicon.svg
│ └ (other static files)
├ (other files)

after

├ src
├ static
│ ├ favicon.svg
│ └ (other static files)
├ uploadImages // new place, not only here
│ └ (upload images here)
├ (other files)

in this way, we can achieve many things:

  1. there is no difference between dev and other mode
  2. we can make a configuation in .env file to select other folder
  3. it can also handle by web server software, like nginx, if I put it in like /opt/anonymous_board/upload_images, there is no need to serve the images by Node.js
lang-html

AltStyle によって変換されたページ (->オリジナル) /