CSS file not loading Laravel Localhost - css

I am trying to load CSS file in localhost but it's just showing white page. I was try to drag and drop file direct to browser and its opened. So file its not empty. and file also open when i use a server and add link to file.
I am using laravel 5.8, PHP 7.2
<link href="{{ URL::asset('css/style.css') }}" rel="stylesheet" type="text/css" media="all" />
CSS file location /public/css i am getting link in source http://localhost/css/style.css

This is most likely a file reference error. Check the markup output and compare the file URL against where it actually sits in the directory structure. If they match up, maybe a directory permissions issue?

In css links only asset is working fine... No need to include URL. so try using only asset.

Related

Django, forcing reload of css/js, and collectstatic

Let's say that I've done a good bit of update to my css files on my dev machine (with my browser set to ignore the cache, no always seeing updates right away).
In this question and other places, I've seen the approach of adding a version number to the links:
<link type="text/css" href={% static "/path/mystyles.css?version=2" %} rel="stylesheet">,
which is fine, but on the dev machine, I get an error in the console, and the file isn't found:
GET http://127.0.0.1:8000/path/mystyles.css%3Fversion%3D2 net::ERR_ABORTED 404 (Not Found)
I've read that perhaps collectstatic will fix it on the dev side, but there's an ominous-looking warning:
You have requested to collect static files at the destination
location as specified in your settings:
/patttthhhhh/static
This will overwrite existing files!
Are you sure you want to do this?
What will happen when I run collectstatic? Where will it get files from to overwrite those?
The recommended way would be to use something like django-compressor (usage) or the likes to process your CSS into a single file and then bake a hash into the filename or dir. So that way your asset would become /mystyles.beb23fe.css.
What ended up working easily was changing the format of the version tag:
<link type="text/css" href="{% static '/path/mystyle.css' %}?version=2" rel="stylesheet">
instead of:
<link type="text/css" href={% static "/path/mystyles.css?version=2" %} rel="stylesheet">
Is fine in dev and production.

Linking CSS file in Laravel 5.5 does not work

I created a new project using Laravel 5.5 and I am trying to link my CSS but it does not work. When I put some CSS codes nothing happens to my page. I already tried clearing my cache. I do not know whats wrong, please help. Here is how I linked my css in my app.blade.php
<link href="{{ asset('css/style.css') }}" rel="stylesheet">
Here is my css code:
body{
background-color: black;
}
Any help would be appreciated. Thanks.
If you put the css inside a css file in your resource folder, you need to build it with NPM:
npm install
then
npm run watch
If you directly put it in the public folder, have you checked to make sure you're linking the right file? Also, try ctrl + f5 to hard refresh
The file style.css must be there in the required location. By default it will be:
/public/css/style.css
Otherwise if you have changed the resource path to your web server root, then it could be:
/css/style.css

How to load a new css file by not loading existing css file

I am using spring, when i run my project in web common.css files and js files will load. Now, when i run project the existing css file should not load, new css file should load in runtime.For example, if i open my project in web then a.css file sholud load , if i open it from android b.css file should load.
In spring i used web interceptor class http://alvinalexander.com/java/jwarehouse/spring-framework-2.5.3/src/org/springframework/web/servlet/mvc/WebContentInterceptor.java.shtml, in this class i am getting file paths from lookup path variable when i run my project . Here i tried to update file path but it is not working.please help me how can we do it.
Thanks in advance.
Add that css file which you want to override other after that file.
For example you you want to override 'a.css' to 'b.css' than
<link rel="stylesheet" type="text/css" href="b.css">
<link rel="stylesheet" type="text/css" href="a.css">
Here a.css will override b.css

How can I install assets in web/css/ folder

I have installed Symfony 2.8 and I have put header.css in web/css, but I don't know how can I access it.
The web browser returns the following error:
GET http://www.grupoinversores.com/css/header.css 404 (Not Found)
You need symlink. For example... here you js, css, img directories:
AppBundle/Resources/public/
In console command $ php app/console assets:install --symlink creates symlink for this js, css, img directories for AppBundle/Resources/public/.
Now you js, css, img here: web/bundles/app/css, web/bundles/app/js, web/bundles/app/img and for currect generate path use this:
<link rel="stylesheet" href="{{ asset('bundles/app/css/style.css') }}">
http://symfony.com/blog/new-in-symfony-2-6-smarter-assets-install-command
it seems based on live page as I looked there you have created a "header.css" directory not a file. No 404, though.
Do you use Twig? Can you post the part of your HTML that tries to call your header.css file?
If you are using Twig, have you tried something like:
<link href="{{ asset('cms-assets/css/bootstrap/bootstrap.css') }}" rel="stylesheet" />
inside your HTML?
In my case the bootstrap.css file is inside the folder:
/web/cms-assets/css/bootstrap
And as seen, I can access it using the "asset" with Twig

webpage unable to load css file

this is a newbie question for you guys.
In file
/home/myhome/apache-tomcat-6.0.29/webapps/view/test.jsp
I have <link rel="stylesheet" type="text/css" href="WEB-INF/resources/view.css"/>
and the view.css file is located at
/home/myhome/apache-tomcat-6.0.29/webapps/view/WEB-INF/resources/view.css
For some reason, it's not loading the css file. But when I put the css file in the same directory as the jsp page and change href accordingly, it worked. What did I do wrong in my attempt to load the file from another folder?
Thanks alot.
try
Firebug, to debug if path is correctly loaded or not. As i can see it issue with path so you have to debug.
http://www.ehow.com/how_2221659_debug-css-firebug.html
But you can try with this line instead
<link rel="stylesheet" type="text/css" href="/view/WEB-INF/resources/view.css" />
Since I am using tomcat, I guess tomcat just won't let a page access anything in the WEB-INF folder, I moved the file else where not in WEB-INF, it worked...

Resources