Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: Add sub directory config in nuxt.config.js #2021

Closed
potato4d opened this issue Nov 3, 2017 · 8 comments
Closed

proposal: Add sub directory config in nuxt.config.js #2021

potato4d opened this issue Nov 3, 2017 · 8 comments
Labels

Comments

@potato4d
Copy link

potato4d commented Nov 3, 2017

Hi, I maintain multiple Web sites with subdirectory structure created by Nuxt.
(e.g. https://push7.jp/docs )

Then, I have a problem with such a site.

Nuxt build and generate are excellent, but they are always made to refer to the .nuxt directory for the root directory.

I solve this by linking with a shell script etc, but it is not a good idea.

To solve this problem, I would like to add a function that can manage the target directory with the configuration called subdirectory as Nuxt's function.

In particular, in Japan such a URL structure is very popular, so there are many opportunities to use.

If this proposal is allowed, I would like to implement it even soon!

Config sample

in nuxt.config.js

{
  ...
  subdirectory: Boolean | String
  ...
}
{
  ...
  subdirectory: false // default
  ...
}
{
  ...
  subdirectory: '/blog/'
  ...
}
This question is available on Nuxt.js community (#c1795)
@christophwolff
Copy link

Have you tried the Vue Router Base Property?

module.exports = {
  router: {
    base: '/app/'
  }
}

https://nuxtjs.org/api/configuration-router/

@KonstantinVlasov
Copy link

I'm not sure if I understand you correctly, but maybe buildDir is what you are looking for?

buildDir: './nuxt/blog' // default: './nuxt'

@potato4d
Copy link
Author

potato4d commented Nov 5, 2017

@christophwolff @KonstantinVlasov
Thanks feedback!

But, It seems to be a little different from what I'm seeking.

I need

<link href="/blog/_nuxt/manifest.bdb5daca1950a978e030.js" rel="preload" as="script">

nuxt generate result

<link href="/_nuxt/manifest.bdb5daca1950a978e030.js" rel="preload" as="script">

Is it possible to add a path before /_nuxt ?

@KonstantinVlasov
Copy link

I think publicPath can help you

@potato4d
Copy link
Author

potato4d commented Nov 5, 2017

@KonstantinVlasov
I have tried it in the past.
But, It was a little different from what I wanted.

I am hosting another web site directly under the domain and /docs.

result:

screen shot 2017-11-05 at 21 59 17

I need:

screen shot 2017-11-05 at 21 59 27

@husayt
Copy link
Contributor

husayt commented Mar 8, 2018

see https://nuxtjs.org/faq/github-pages and also https://nuxtjs.org/api/configuration-build#publicpath

That should resolve it for you. Closing. Reopen if still not clear.

@husayt husayt closed this as completed Mar 8, 2018
@ramjamx
Copy link

ramjamx commented Jul 23, 2018

I think this proposal is valid and necessary, you not always want to publish in the root directory, publish path solve the problem but you need to change your image routes. with this helper you may decide where you want to publish (main domain or a folder) with just one config.

@lock
Copy link

lock bot commented Nov 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants