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 use or operator in laravel
- Method Illuminate\Http\Request::validated does not exist
- How to avoid duplicate entries in pivot table in Laravel
- How to insert value to additional columns in pivot table in laravel
- Target class [admin] does not exist.
- How to display validation error in laravel
- How to display 1 day ago in comments in laravel view
- Store logged in user details in session and display in view in laravel
- How to change default timestamp fields name in Laravel
- Send post data from controller to view
- How to add active class to menu item in laravel
- FirstOrCreate() Not Inserting Model
- Redirect to previous page or url in laravel
- How to create new user without form submission in laravel
- Display option of select as selected with blade directive Laravel
- How to get date from created_at field in laravel
- How to authenticate admin users in Laravel ?
- Validation errors for multiple forms on same page Laravel
- Get last week data in Laravel
- How to get random string in Laravel
- How to create event and listener in laravel ?
- How to Access Array in blade laravel
- How to call model in blade laravel
- Argument 1 passed to App\Http\Controllers\Auth\LoginController::authenticated() must be an instance of App\Http\Controllers\Auth\Request
- Create record with unique slug in laravel