
Include External CSS and JS file in Laravel
Include External CSS and JS file in Laravel
In this tutorial, we will try to find the solution to "Include External CSS and JS file in Laravel" through programming.
You can include external CSS and JS file using asset helper method in Laravel. Place your CSS and JS file in public directory (**project/public**) and after that use asset method `{{ asset('style.css') }}` in href attribute of link tag and `{{ asset('custom.js') }}` in src attribute of script tag to add both javascript and css file in Laravel.-
Add external CSS and JS file in Laravel
To add external css and js file, follow these steps:
- create subfolders named css and js in public folder.
- Place style.css file in CSS folder.
- Place custom.js file in js directory.
- Open blade file.
- Place code in head tag of blade view file.
resources\views\welcome.blade.php
<link rel="stylesheet" href="{{ asset('css/style.css') }}"> <script src="{{ asset('js/custom.js') }}"></script>
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- How to fill a column automatically while creating records in Laravel
- Recursive function example code PHP Laravel
- How to check if user has created any post or not in laravel
- Delete all related comments on deleting a post in Laravel
- How to check relationship is loaded or not in Laravel
- SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel8.projects' doesn't exist
- Laravel append URI in route
- SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'user_id'
- Conditional validation in laravel
- Print query in laravel
- How to get specific columns using with method in laravel Eloquent relationship
- Laravel route redirect not working
- Pass value from controller to model in laravel
- Laravel specific table Migration
- How to pass variable from controller to model in Laravel
- How to pass data to route in laravel?
- Laravel 9 pagination with search filter
- Run artisan command to generate key in laravel
- Add class to body in laravel view
- Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to tcp://smtp.gmail.com:587 (Connection refused)"
- Get laravel version
- Get duplicate records in laravel
- How to upload image in laravel 8
- Composer\Exception\NoSslException
- How to create static page in Laravel