Springboot can't find resources! (Suddenly stopped working) - spring-mvc

So the thing is, since I moved my resources (css, images, js) to resources/static folder my stuff started working.
Until I created a new .html page (meant to be dynamic) and pasted in resources/templates. Then all my resources (css, images) stopped working (can't be found) and I can't make it work again.
I'm using SpringBoot + Thymeleaf and the code can be found at GitHub
I couldn't manage to find a solution after 3 hours of searching, that's why I'm here. Thank you, hope you guys can help :/
Edit (some images):
My project structure
The link:
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css'/>
<link href="css/bootstrap.css" rel='stylesheet' type='text/css'/>
What happens (was working before, I didn't change anything in the code of listed images)

I'm not sure what happened but after starting deleting/commenting some code I wasn't using anymore I started to get errors and managed to track the next file to "fix" (delete or comment) and after that it worked again.
Looks like something in the application wasn't right and it didn't give me any erros so I had to manually try to find it.
I'll keep updating this thread if I find anything useful related.

Related

Jekyll site works locally but not on Github Pages

I forked the Solid-jekyll theme (solid-jekyll) and got it to work locally. However, when I pushed it up to Github pages, it seems to loose it's css formatting.
My fork of solid-jekyll is on github, username:BeenzSyed. I tried changing the baseurl to "/solid-jekyll" but that didn't work either.
This is what it looks like on my fork: https://beenzsyed.github.io/solid-jekyll/.
This is what it should like though: http://ojs.xyz/solid-jekyll/.
I think it's because it can't find the _includes/css/style.css file but I'm not sure what to do to fix that. Any help is appreciated!
Faced exactly same issue long back and it consumed 2-3 days. Find your main stylesheets (like main.css) and save it to assets folder and commit. This way Github will be copying stylesheet to site built. It usually won't copy :( main.css
I followed the suggestion of dracos on this GitHub Issue page and related commit to change /_includes/head.html from:
<link rel="stylesheet" href="{{ site.baseurl }}public/css/poole.css">
to
<link rel="stylesheet" href="{{ "/public/css/poole.css" | relative_url }}">
Changing most site.baseurl references to relative_url works in both local testing and on GitHub Pages.
My commit for changes to my site can be found below:
https://github.com/naamancampbell/naamancampbell.github.io/commit/f60da4d4e48447708c2e157ff1e07303d5377587
As someone pointed out, the live demo uses a different stylesheet. So the repo isn't the same. I suggest creating a new issue in the repository.

Jekyll on Github Pages applying css styles inconsistently

I am not sure what's going on, but my personal site - built with Jekyll and hosted on Github pages - has been exhibiting odd css styles behavior as of the last few weeks or so.
I originally set it up on Jekyll 1.something-or-other. I am aware that it is at 3.something now and for the longest time, through 2 etc. I have not had a problem with the styles, everthing was fine up until less than a month ago.
I have not made any changes to the styles configuration for a couple years, but now it is only rendering the styles for the pages (Homepage, About Page, list pages for archives, etc.). But on the actual posts, it drops all the styles - looks like raw markdown and images and no layout.
I have updated jekyll to 3.1.2 on my local machine, and what's even stranger is that when I run it locally, it builds fine and all, but the problem is the opposite. That is, all the posts are formatted with the appropriate styles, but the pages (again - Homepage, about page, archive list) are unstyled.
Again, no changes in any configurations. Is there some obvious places I should be looking? I am using the jekyll bootstrap theme that's a little customized. but not much.
Site is http://subtxt.in
I found your repo and poked around. There is a lot going on there, it seems overly complex.
Using Chromes dev tools you can see the problem is with the css loading - on good pages the correct path is: <link href="/assets/themes/the-minimum/css/style.css" rel="stylesheet" media="all">
On posts where it doesn't work it is: <link href="/assets/themes//css/style.css" rel="stylesheet" media="all">
Note the missing theme name - the-minimum.
In your repo I can't quite figure out the logic, but you could simplify it I think. This file - _includes/themes/the-minimum/default.html I believe contains the head section for all pages.
The line <link href='{{ ASSET_PATH }}/css/style.css' rel="stylesheet" media="all"> I think is the problem, `ASSET_PATH seems to come back with different values. Try just hard coding it to be the correct path like:
<link href="/assets/themes/the-minimum/css/style.css" rel="stylesheet" media="all">
I'm not 100% sure this will fix it, but I think it will.
I would add a link to your repo if this doesn't fix it for you so other people can check it.

custom 404 sometimes missing stylesheet

I have a website hosted by siteground, and my custom 404 page is SOMETIMES missing it's stylesheet. I contacted support but they saw it working fine, assumed I just codded it wrong, and told me to get help form a professional web programmer... (of course I did test before contacting them to be sure it was not my fault)
Anyways, the way that siteground allowes you to create a custom 404 page is to add your html code to a form in your control panel, wich creates a 404.shtml in your main folder. The .shtml contains all your html. I have done the following test to narrow down the problem.
created a not404.html in my main folder with code copy pasted from my 404.shtml that is in the same folder. It loaded with my stylesheet applied no problem.
tried prompting a 404 page with both bad hyperlinks, and by typing pages that do not exist. When I am having the problem with my stylesheet missing, none of thease pages have css, but when I am not having the problem, they all have css applied.
What I think it is: I think that the 404.shtml is not really in my main folder, but just appears to be there, and sometimes that link breaks and the 404.shtml is actualy acessed somewere else on sitegrounds server, therefor the style link would not work properly. This would explain the intermittent css failor. But this is just logic, not understanding.
The only thing I can think of that would be wrong on my end is if there is more than one way to link stylesheets, and my way is a bit unstable. Here is the format I use.
<link type='text/css' rel='stylesheet' href='css/404.css'>
I know this might be a difficult question, but it would be pretty satisfying to figure this out and inform them of the problem with their site.
Change the href for the style tag to be absolute. So this:
<link type='text/css' rel='stylesheet' href='css/404.css'>
Becomes this:
<link type='text/css' rel='stylesheet' href='/path/to/css/404.css'>
css/404.css is a relative path. If the path is something like /path/to/nonextant/page it will try to load the stylesheet from /path/to/nonextant/page/css which does not exist.
Use an absolute path:
/css/404.css

Weird page loads sometimes in Rails 3.2 could be CSS?

I've only been programming for roughly 20 weeks so every problem I run into is new to me...
I'm not quite sure, but I suspect that sometimes my page loads prior to all my CSS files loading because I'll see the page content for a brief second then suddenly the CSS takes over and presents the page.
Any ideas on what I could possibly do to fix this? If this is a little hard to imagine, my website is http://www.instamap.it
yep, looking at your source, you should move the link for your css to the head in your application layout.
It's because your CSS is being linked at the end of your document instead of the beginning, so the page loads everything else first.
This line (169):
<link href="/assets/application-9541dd7ae253c39af6731980dce6e296.css" media="all" rel="stylesheet" type="text/css" />
should be in the head of your document. This way the CSS will load before everything else.

Site hosted on dropbox not using CSS

I'm hosting a (very) small website on dropbox. I don't even have a domain name for it, I just need an easy way for my not so technology savvy teacher to access it and using an online service like wordpress or tumblr seemed like too much trouble and not as effective as I would like. I plan on putting it in my public folder and just sending her that link, something I've done in the past to show my friends websites I've made in class.
However, for some reason, CSS formatting isn't working. This is a problem I've noticed in the past but at the time wasn't important. I have it relatively linked in my head tag and it works when I pull up the files saved on my hard drive. Its only when I try to access it through dropbox do I notice this problem.
I've looked and it doesn't seem like anyone else has had this problem, I've only found multiple references to dropbox supporting CSS so I have no idea why this is happening.
This is the link in my code, and it's inside the head tag:
<link rel="stylesheet" type="text/css" href="css/format.css" />
Any help would be much appreciated. ^^
EDIT: Here's the page, there's not much on it yet but there's suppossed to be background formatting behind the navigation links in the top.
https://dl-web.dropbox.com/get/Public/EPortfolio/WritingAndForum.html?w=947f0aa1
To give an example expanding on Cfreak's comment, you would need to individually share the CSS file, then reference it in the HTML like this:
<link rel="stylesheet" type="text/css" href="https://dl.dropbox.com/u/1234567/cssfile.css">
A much easier way (and more correct) is to put your stylesheet in a folder called css and then have a relative link to it with "./" It gets you out of the long url trouble.
<link rel="stylesheet" type="text/css" href="./css/styles.css">

Resources