Thymeleaf: css path not found and applied - html

Somehow i got trouble figuring out the correct path. See below for the hierarchy:
Found out that the browser sends a request to http://localhost:8080/assets/vendor/bootstrap/css/bootstrap.min.css, which does not work. Are the packages located correctly?
It also works fine if the index.html is located in the assets folder as well.
git repo: https://github.com/elps/elpsstackoverflowrepo

try these:
<link href="../static/assets/vendor/font-awsome/css/font-awsome.min.css" th:href="#{/assets/vendor/font-awsome/css/font-awsome.min.css}" rel="stylesheet" />
<link href="../static/assets/vendor/font-awsome/css/font-awsome.min.css" th:href="#{/assets/vendor/simple-line-icon/css/simple-line-icon.css}" rel="stylesheet" />

I assume that you are trying to deploy to a server.
For example, if you deploy a myapp.war file into a Tomcat server, your
application will probably be accessible as
http://localhost:8080/myapp, and myapp will be the context name.
Context-relative URLs start with /:
<a th:href="#{/order/list}">
If your app is installed at http://localhost:8080/myapp, this URL will output:
<a href="/myapp/order/list">
Therefore, you are missing static folder in your url. Pay attention to the deployment process of your application.

Related

Deploying Blazor PWA to server folder, I get errors saying that various files cannot be found

I can deploy to the root of a server (e.g. http://localhost:8008) but I can't deploy to a subfolder (e.g. http://edkolis.com/pwaexperiment/wwwroot/index.html); I get errors loading various files when I try that. Files that are missing include app.css and blazor.webassembly.js:
<link href="css/app.css" rel="stylesheet" />
<script src="_framework/blazor.webassembly.js"></script>
I see there is a <base> tag in the index.html that specifies that all relative URLs should point to the server root:
<base href="/" />
however if I remove this tag I still get the same errors. How can I deploy my Blazor PWA to a subfolder and have it work, and yet also have it work at the root for local testing (i.e. I don't want to hardcode a server URL into the <base> tag)?
The base href must match the actual path you deploy to.
To avoid changing it build-time, update the launchsettings JSON with that folder name so local (dev) runs also use the"production" base path

"Page Not Found" upon deploying site to Netlify via Github repo

I'm a complete beginner to web development and am trying to deploy my first site via Netlify. Despite my site working fine when being displayed from my local machine, I'm given the following error when navigating to my site's URL:
Page Not FoundLooks like you've followed a broken link or entered a URL that doesn't exist on this site.Back to our site
Since my page is functional on my local machine, I believe the error lies within my Github repo and/or my deploy settings. Here's my repo:
https://github.com/Cotton0419/TestSite
And my deploy settings:
Repository: github.com/Cotton0419/TestSite
Base directory: acme
Build command: Not set
Publish directory: acme/disp
Deploy log visibility: Logs are public
Any help would be greatly appreciated, I can supplement more information if need be.
The Base directory on Netlify is only used by the build environment for a reference to your code base (defaults to root of the repository if not given).
The Publish directory would be relative to the base directory. So in your case disp or acme/disp if using the default.
You are referencing assets in a location that does not exist in your published paths, so they would not exist in your deploy to the CDN.
<link rel="stylesheet" href="../css/style.css">
You should move your assets into your deploy disp folder and edit the correct paths into your code files.
Similar problem I encountered today. I decided to upload an old portfolio I had made a while back. Then for some reason after running the URL on Netlify, nothing happened. The only thing that showed up was a prompt similar to yours -
Page Not Found
Looks like you've followed a broken link or entered a URL that doesn't exist on this site.
Back to our site
After revisiting the HTML and CSS files, I realized that I had set the title for my HTML file to porfolio.html instead of index.html which solved my problem!
For this kind of error please kindly check the HTML filename change it into index.html it worked for me!

Polymer: Failed to load resources after build

I'm new to polymer. I've followed a couple of tutorials to learn the base of the library. However, I always encounter a problem after building the app.
Here is a summary how to reproduce my problem.
polymer --version //returns 1.6.0
mkdir poly-app
cd poly-app
polymer init // Select polymer-2-application
polymer serve --open // works fine
polymer build
polymer serve build/default --open // works fine
Now, I would like to export my code to my web server. I copy paste the content of /poly-app/build/default and I paste it on my web server. When I try to access it, it get errors such as:
Failed to load resource: the server responded with a status of 404 (Not Found)
I found that the problem comes from the following lines of code in /poly-app/build/default/index.html:
<script src="/bower_components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="/src/poly-app-app/poly-app-app.html">
In order to fix the problem, I need to remove the first / in the src and href attribute.
<script src="bower_components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="src/poly-app-app/poly-app-app.html">
Apparently I need to do this manually every time I build the app. Is there any other way to fix automatically?
Thanks a lot!
I believe you are trying to serve it from a non root path on your website?
In that case you should set the basePath property of the build configuration to the respective path and the generated code should populate the <base> tag with the needed information so the urls are working.

Laravel blade template view HTML::style not linking in sub folder

I have:
{{HTML::style('css/bootstrap/bootstrap.min.css')}}
Which in the source code comes out as:
http://www.view.local/laravel/css/bootstrap/bootstrap.min.css
Which is wrong.
It should be:
http://www.view.local/laravel/public/css/bootstrap/bootstrap.min.css
But of course I don't want it to show the laravel part of the source.
The project directory is:
http://www.view.local/laravel
Which is working fine for everything else.
How can I get this to work properly?
This works exactly as expected.
Public folder should be configured as root directory for laravel applications. You should set path_to/laravel/public as directory for your virtual host. That will solve the issue.
Making path_to/laravel as root directory will make your application vulnerable. Always make sure that you give web access only to public directory. If you are hosting on a linux based web server, the content of public folder should go to public_html folder.
Laravel links all the resources file to the public folder so you can use the asset() function in this way:
<link href="{{ asset('style.css') }}" rel="stylesheet" type="text/css">
where style.css must be in public/ folder

Html, external CSS link fails on Linux

I know similar questions have been asked but cannot see why our external css link doesn't work on Linux. The folder structure on both Windows and Linux is:
/
/static
/css
style.css
/img
/js
/html
index.html
The index.html links to style.css with:
<link rel="stylesheet" type="text/css" href="../static/css/style.css" />
It works on Windows but fails on Linux with a 404. This would imply that the /static folder and sub-folders don't have the correct permission but they actually have identical permissions as the /html folder. If all the /static content is placed in the /html folder then it works.
Has anyone come across a similar situation or know what the problem is?
Are you using mod_rewrite ? It has to be a server config issue. Make sure it is configured right
To be sure the path is ok, open index.html on the browser and check the path of css file from the page source there.
The problem can probably be permission on the css file.
The user apache ir running on must be able to read the file, otherwhise it will fail to load it
you can try running:
chmod a+r style.css
to add read permission to everyone on that file, or:
chown [user]:[group] style.css
to change the owner of the file to the user and group apache is using.
You can also check which user apache is running on in this question Finding out what user Apache is running as?
By default it usually is apache user and apache group.