G
G
Goobert Crypto2020-07-03 21:43:09
Laravel
Goobert Crypto, 2020-07-03 21:43:09

How to include css and js in blade, Laravel 7?

How to include css and js in blade template? Where should css and js be by default if you are working with a template? This construction doesn't work "{{ URL::asset('js\jsssss.js') }}"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2020-07-03
@goober-crypto

Choose any option.

<script src="{{ asset("js/jsssss.js") }}"></script>
<script src="{{ URL::asset("js/jsssss.js") }}"></script>
<script src="/js/jsssss.js"></script>

Similarly with css:
<link rel="stylesheet" href="{{ asset("css/csssss.css") }}">
<link rel="stylesheet" href="{{ URL::asset("css/csssss.css") }}">
<link rel="stylesheet" href="/css/csssss.css">

In this example, the files are in public/js and public/css. You can do any level of nesting, but so that all this is inside the public folder.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question