How to referemce favicon in index.html from /source - vue.js

Can someone please tell me, if it is possible to use the favicon.ico file that is located in src/assets/img/favicon.ico? I tried to change the href but it won't work for me. The one in the public will be deleted. How could I reference it in my index.html?
Thank you

BASE_URL returns public folder, you can use cdn or do not delete inside public folder because if you build this code there won't be src folder.

Related

How to Serving static files with express if it is inside a subdirectory

I am having trouble with serving a html file which is inside a subdirectory inside public folder.
My directory structure looks like:
public/
HTML/
index.html
index.js
I want to serve the index.html for the root route.
This doesn't work:
app.use('/',express.static(path.join(__dirname,'public')));
According to the docs, this should be enough:
app.use(express.static('public'))
It also gives you such example
http://localhost:3000/images/kitten.jpg
http://localhost:3000/css/style.css
http://localhost:3000/js/app.js
http://localhost:3000/images/bg.png
http://localhost:3000/hello.html
It doesn't go much further other than explaining how you can set up multiple public directories. Anyway, it has worked for me in my projects.
Perhaps you need to state directly app.use(express.static('html')) or app.use(express.static('public/html')). Let me know what works for you.

Reference HTML file in iframe with Quasar framework

I need to open an static HTML file inside an iframe because I need it to be printed silently, I’m trying setting the iframe src with absolete and relative paths but none of them work, I’ve tried moving my files inside public, static and assets folders with no success, I’ve seen that some people uses process.env.BASE_URL to access absole path of environment but it doesn’t work in Quasar.
Currently I have my files in a folder called ticketTemplates inside public folder placed at root, and it has two files: first.html and first.css, I’m doing the following:
<iframe src="ticketTemplates/first.html" frameborder="1"></iframe>
But as I said before it does not with relative or absolute paths. I've tried with http://localhost:8080/ticketTemplates/first.html too and it does not work.
Could you tell me how to achieve it?
I opened this tread in Quasar Forum and I found I was using an outdated version of #quasar/app, I updated my project and the content worked inside my iframe.
I moved my ticketTemplates folder inside public folder located in root directory, next to quasar.conf.js file and the resulting code was:
<iframe src="http://localhost:8080/ticketTemplates/first.html" frameborder="1"></iframe>
All the credit goes to the user who helped me.

How to generate txt & xml files in nuxt SSR?

Is there any way of generating a Google : ads.txt file every time i build my SSR project?
There is a module called: sitemap-module from nuxt-community, it is used to generate a sitemap xml file, and that file can be accessed by http://domain.tls/sitemap.xml. and i want something like that.
So currently i'am achieving this by building the project, then manually put ads.txt it in : /var/www/site/.nuxt/dist/client/,
The problem with this is that everytime i rebuild the project i loose /var/www/site/.nuxt/dist/client/ folder then i have to add ads.txt file again.
I would like to know how i can hook up my code to tell nuxt to generate ads.txt file and put it in /var/www/site/.nuxt/dist/client/
Not sure if it makes sense, but i hope someone will understand.
Place your ads.txt file in a directory named static as mentioned here. All the contents of the static directory can be accessed via example.com/{filename.extension}
If you are not using nuxt.js and just using vue js, place it in a public directory right next to src directory.
Haven't found any way of solving this in nuxt, so i decided to redirect all https://domain.tld/ads.txt in Nginx configuration.
/etc/nginx/sites-available/default.conf
#redirect all txt request
location ~* ^.+.(txt)$ {
root /var/www/other.files/;
}
So i think i'll stick to it.

Vue Nuxt.js - deploy in subfolder

I have a Nuxt.js project and I generate a static app. I need to put it in a subdirectory on ftp, but I can't make it work.
I've set router.base to /subfolder and that works fine for _nuxt, but static files are still using absolute path /img/...
So I've tried to put my static files into assets/img/, but they are not getting loaded from scss when I use ~assets/img/...
I've read many topics, but couldn't find the solution.
Any ideas?
Thank you
I had trouble finding solutions in the documentation as well, but I found out you can use the static folder on a subdomain if the links are changed from:
/image.jpg
to:
~/static/image.jpg
Also if it helps, I believe changing:
~assets/image.jpg
to
~/assets/image.jpg
Might solve your issue?

How to change path in the laravel config if It's located in the folder upper then public?

I have laravel 5 and config file in the config folder and My css located in the resources folder which is a same level with public folder where located index.php. Virtual Host Apache config looks to the public folder as a root site directory, but in this situation I cannot declare correct path from /public/index.php to the resources folder.
From one side I can try easy way and just relocate public folder into root of the laravel, but I don't like this way, any ideas?
Use resource_path('path/to/your/css')
https://laravel.com/docs/5.3/helpers#method-resource-path
EDIT
The most logical is to include your stylesheets in your public folder though. If you need to style a page, the style is public anyway. So why not put in the public folder. There's 2 options to do this:
Do it manually by just copying/moving the files
Use an automated tool like Gulp or Laravel's own Elixir, which provides a really easy way to copy your assets.
add this code in public/index.php
$app->bind('path.public', function() {
return __DIR__;
});