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

Mount a directory to a route doesn't works #191

Closed
JuanJoseGonGi opened this issue Aug 27, 2018 · 3 comments
Closed

Mount a directory to a route doesn't works #191

JuanJoseGonGi opened this issue Aug 27, 2018 · 3 comments
Assignees

Comments

@JuanJoseGonGi
Copy link

I have two folders in the root. "/app" and a "/.tmp". In the first one there is an index.html file and a subfolder "/styles" with main.scss. In the second one there is a subfolder "/styles" that contains main.css (The main.scss already processed).

In my settings I have

{
  "liveServer.settings.ChromeDebuggingAttachment": true,
  "liveServer.settings.file": "index.html",
  "liveServer.settings.root": "/app",
  "liveServer.settings.mount": [
    ["/styles", "../.tmp/styles"]
  ]
}

Only load the index.html

@JuanJoseGonGi JuanJoseGonGi changed the title Mount a directory to a route Mount a directory to a route doesn't works Aug 27, 2018
@markbjerke
Copy link

The same problem, mount doesn't seem to work.

@gijswijs
Copy link

Checked out the source code.

The mount works, but you have to reference the folder from the workspace root. And you have to use the period, otherwise it starts looking from the drive root.

So

"liveServer.settings.mount": [
  ["/styles", "./.tmp/styles"]
]

@ayelsew
Copy link

ayelsew commented Aug 14, 2022

Just for common knowledge.
I spend a lot of time trying to use wildcards to mount my paths to dir like: ["/*js", "./out"].
Analyzing that code, I saw that the server HTTP package, used by liver-server is the Connect, And it doesn't support wildcards as you can see in this issue: app.use documentation.

So if you are working with distributed files in any directories on your workspace, and these files for some reason are represented by / (root path),

In my case I have:

|--- src
|      \ index.html
|--- out
       \ index.js

Considering do this:

    "liveServer.settings.mount": [
        ["/", "./src"],
        ["/", "./out"],
    ],

It will look up index.html at ./src, index.js at ./src (didn't will be found) and at ./out (here works).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants