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
- SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key
- Save or update pivot table data with additional column in Laravel
- Docker important commands to run laravel application with docker
- SQLSTATE[42000]: Syntax error or access violation: 1055
- How to upload local Laravel project to server ?
- Call to a member function getRelationExistenceQuery() on array in Laravel
- Get products with number of orders in Laravel
- How to add background image to div using Tailwindcss, Vite in Laravel Environment
- Root composer.json requires php ^7.3 but your php version (8.0.0) does not satisfy that requirement
- How to create static page in Laravel
- Method chaining in Laravel
- How to pass query string to url in laravel
- How to remove P tag from CkEditor in Laravel?
- How to get all route list
- Check if Relationship Method Exists in Laravel
- How to fill a column automatically while creating records in Laravel
- Get 30 days older records from table in laravel
- How to pass data to multiple partial view files in laravel
- Run artisan command to generate key in laravel
- Get count of filter data, while return a small set of records
- FirstOrCreate() Not Inserting Model
- Method Illuminate\Database\Eloquent\Collection::appends does not exist
- Create project table with model and migration
- Redirect to previous page or url in laravel
- The POST method is not supported for this route. Supported methods: PUT.