CSS and JS files is not loading in Laravel - javascript

My application is on the server, and I have tried all the solutions. But my Laravel app is still not loading CSS and JS files in main.blade.php when my CSS files are in public/assets_setup/css/style.css.` I even made file changes, but page changes are not showing in inspect, and it's the same.
Below is my main.blade.php file which all links are included.

Try this code
<link rel="stylesheet" type="text/css" href="/assets_setup/css/style.css">
or
<link rel="stylesheet" type="text/css" href="{{ asset('/assets_setup/css/style.css') }}">

We don't write public in laravel

Related

How to connect internal Bootsrap 5.2 with laravel 7

Hey i still learning laravel framework and i try to connect my bootstrap v.5.2 with my laravel v.7 project but it cant connect, i store css and js folder on bootsrap folder in the same level as app, config, database public, etc. and i already tried to connect it with the code:
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" >
<script src="bootstrap/js/bootstrap.min.js"></script>
but it still cant connect?
Put Your bootstrap files (i.e bootstrap.min.css and bootstrap.min.js) in a new folder inside public.
Example:
public/css/bootstrap.min.css
public/js/bootstrap.min.js
Then to use them in blade:
<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
<script src="{{ asset('js/bootstrap.min.js') }}"></script>

Css and Js files are added correctly but not working in Laravel 5.6

I'm gonna add a template to my laravel, I put template files in public folder and as always, I use the following command to load its files:
<link href="{{ asset('admin-panel') }}/dist/css/bootstrap-rtl.min.css">
<script src="{{ asset('admin-panel') }}/plugins/jquery/jquery.min.js"></script>
None of the files are loaded. In "view page source", the path of files is correct and files are opened But they do not work. What should I do?
At first I wanted to delete the question, but for some it may be interesting that the use of rel="stylesheet" in the link tag is mandatory in Laravel projects. Because this template runs well without being used in Laravel.
<link href="{{ asset('admin-panel') }}/dist/css/bootstrap-rtl.min.css">
Change to:
<link href="{{ asset('admin-panel') }}/dist/css/bootstrap-rtl.min.css" rel="stylesheet" />

Can't Access stylesheet through partial in Node Express App (handlebars)

I'd admit I am relatively new to node in general, and I am stuck on this issue in regards to being able to use a style sheet within a partial.
This is my file structure
app.js
public
images
javascripts
stylesheets
style.css
views
layouts
main.hbs
partials
head.hbs
navbar.hbs
error.hbs
index.hbs
I made sure to include this within my app.js and also required the path module.
app.use(express.static(path.join(__dirname + 'public')));
This my link to my stylesheet within my head.hbs partial.
<link rel="stylesheet" type="text/css" href="/public/stylesheets/style.css">
Any suggestions?
Instead of doing:
<link rel="stylesheet" type="text/css" href="/public/stylesheets/style.css">
try:
<link rel="stylesheet" type="text/css" href="/stylesheets/style.css">
(without /public/)
Currently you are telling express.static to look for a file in: /public/public/stylesheets/style.css.

Dot net, Some Views can't access css&js files

The problem here is that some views (not all of them) can't access to some css&js files(not all of them) ("404 Not found" error).
For exemple View of .../Details/Index/1 can't access to 1file css and 1file js (it can access all other files), but the View of .../Recherche/result can access to all files.
This problem happens when the user is connected and when not connected.
I didn't modifie the web.config file.
All View are related to one Layout, in there I inluded the css files:
<link href="Content/file.css" media="all" rel="stylesheet" type="text/css" />
And one last thing, all css files are in 1 folder and all js files are in 1 folder.
Start the path to the file with the tilde (~) character. Razor will converts a virtual (relative) path to an application absolute path.
<link href="~/Content/file.css" media="all" rel="stylesheet" type="text/css" />
If you are using an MVC version prior to MVC 4, you should use Url.Content helper method.
<link href="#Url.Content("~/Content/file.css")" rel="stylesheet" type="text/css" />

Include external css/js file into html page

I'm trying to link manually my CSS and Javascript files to my HTML scripts, but I've never really done it with files from a different folder/directory. This is what I have so far:
<link rel="stylesheet" type="text/css" href="/Desktop/Script/CSS/tempeststyle.css"/>
<link rel=script" type="text/javascript" href="/Desktop/Script/Javascript/tempestscript.js"/>
I've read from a few sources that you don't have to start all the way at C:/Users or whatever the case may be for different systems, but I'm not sure if these links are acceptable the way they are (i.e., them starting at "/Desktop"). The files are in separate folders within the same folder on the desktop. So how to include them the best way? Thanks.
If you want to add scripts from local path you can use a relative path:
<link rel="stylesheet" type="text/css" href="../CSS/tempeststyle.css"/>
or relative path from your web root folder:
<link rel="stylesheet" type="text/css" href="/styles/CSS/tempeststyle.css"/>
or filesystem absolute path:
<link rel="stylesheet" type="text/css" href="file:///C:/Path/To/Scripts/styles/CSS/tempeststyle.css"/>
It is rather better if you use an absolute path from your web server:
<link rel="stylesheet" type="text/css" href="http://www.example.com/styles/CSS/tempeststyle.css"/>

Categories