
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
- Laravel file size validation not working
- Skip first n record and display rest records in laravel view
- How to upload multiple images after preview in laravel using cropper js
- Get the post details if it has at least one comment in comments table
- Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()
- How to get images from AWS s3 and display in Laravel blade
- Laravel 9 route group with controller
- How to create pivot table in laravel using migration
- Validation for multiple forms on same page in laravel
- How to start websocket server in laravel
- Class 'App\Providers\Auth' not found
- How to create and run user seeder in laravel
- How to check column value of a record is null or not in laravel
- Submit form without CSRF token in Laravel
- Comment .env file in laravel
- How to pass data to partial view file in laravel
- Page loader in laravel
- Delete all related comments on deleting a post in Laravel
- How to restore multiple records after soft-deletes in Laravel
- Conditional where clause in Laravel
- Store logged in user details in session and display in view in laravel
- Method chaining in Laravel
- Laravel 7 login error message not showing
- Add [name] to fillable property to allow mass assignment on [App\Models\Project]
- SQLSTATE[42000]: Syntax error or access violation: 1055