question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Variable Source Path

See original GitHub issue

Hi, is there a way to include the video source path as a variable? Hoping to be able to load most of the path in my config and then pull the filename from other data in my component.

So instead of:

<b-embed type="video" controls>
        <source src="../../../../path/to/myproject/filename.mp4" type="video/mp4" />
</b-embed>

I’d like to be able to do:

config.json:

        "pathToOutputMedia": "../../../../path/to/myproject/",

vuePage.vue:

        <b-embed type="video" controls>
                 <source src="assetPath" />
        </b-embed>
        <script>
                 var assetPath = config.pathToOutputMedia + "filename.mp4";
        </script>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tmorehousecommented, Feb 11, 2020

Depending on your loader configs, prefixing path strings with ~ or @ (aliases) can reference different locations within your project structure…

You can also use :src="require(somePath)" in certain situations.

https://stackoverflow.com/questions/37671342/how-to-load-image-files-with-webpack-file-loader

1reaction
tmorehousecommented, Feb 10, 2020

That is because web server will only serve documents/files that fall under the root path of the server (for security reasons) The root of your URL is http://localhost:8081/, so no matter how many ../ you prepend you can never get above that.

Imagine someone attempting to do this:

http://localhost:8081/../../../../etc/password

or similar to extract password files off of a server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding a Path to the Linux PATH Variable | Baeldung on Linux
The PATH variable is an environment variable containing an ordered list of paths that Linux will search for executables when running a command....
Read more >
How to set your $PATH variable in Linux - Opensource.com
Explore how the principles behind open source--collaboration, ... Simply add /place/with/the/file to the $PATH variable with the following command:
Read more >
How To View and Update the Linux PATH Environment Variable
The PATH variable contains a list of directories the system checks ... To apply the changes to the current session, use the source...
Read more >
Path variables | IntelliJ IDEA Documentation - JetBrains
Use path variables to define absolute paths to resources that are not part of a specific project. These external resources may be located...
Read more >
What are PATH and other environment variables, and how ...
A: The PATH variable sets directory paths to look in when commands are executed, both for RUN commands, and for internal calls from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found