Download
Please note that the sample project does not include the Metronic Tailwind CSS source files by default. To integrate the styles, you need to copy the Metronic Tailwind CSS source files from your downloaded Metronic folder.
Copy Source Folder
src folder from the metronic-tailwind-html package and paste it into the resources directory of your Laravel project. Rename the copied folder to metronic so that the directory structure should now look like this: resources/metronic.
Copy Media Folder
media folder from the metronic-tailwind-html package's dist/assets/media directory into your Laravel project's public/assets directory. The resulting directory structure should look like this: public/assets/media.
Install, Compile & Start Development Server
npm install
npm run dev
php artisan serve
Creating a Laravel Project
Install Composer
Install Laravel
composer create-project --prefer-dist laravel/laravel tailwind-laravel
tailwind-laravel with the desired name for your Laravel project.
Navigate to Laravel Project
cd tailwind-laravel
Run Laravel Development Server
php artisan serve
http://localhost:8000 to see your Laravel app in action.
Integrate Styles
Navigate to Laravel Project
cd tailwind-laravel
Install Dependencies
npm install -D tailwindcss postcss autoprefixer sass
npm install mini-svg-data-uri @popperjs/core
npx tailwindcss init -p
The command will install the necessary dependencies for Tailwind CSS and Metronic. If you wish to use additional features like apexcharts,
axios, or clipboard, you must install them separately.
Copy Source Folder
src folder from the metronic-tailwind-html package and paste it into the Laravel resources directory.
metronic. The directory structure should now look like this: resources/metronic
Copy media folder
media folder from the metronic-tailwind-html package's dist/assets directory into your Laravel project's assets directory.
The resulting directory structure should look like this: public/assets/media.
Import Styles
resources/css/app.css and add the following import statements:
/* Main style */
@tailwind base;
@tailwind components;
@tailwind utilities;
/* Keenicons */
@import "../metronic/vendors/keenicons/duotone/style.css";
@import "../metronic/vendors/keenicons/filled/style.css";
@import "../metronic/vendors/keenicons/outline/style.css";
@import "../metronic/vendors/keenicons/solid/style.css";
app.css file to app.scss. This step ensures that the styles and icon fonts are properly imported and applied to your Laravel project.
Configure Tailwind
tailwind.config.js file from the metronic-tailwind-html package to the root of your Laravel project.
content and plugins array:
// ...
content: [
"./resources/**/*.blade.php",
"./resources/**/*.js",
"./resources/**/*.vue",
],
// ...
tailwind.config.js file. Replace src/core/plugins with resources/theme/core/plugins for each plugin path.
// ...
plugins: [
require('./resources/metronic/core/plugins/plugin'),
require('./resources/metronic/core/plugins/components/theme'),
// ... and so on
],
// ...
Edit app.js File
resources/js/app.js file and add the following import statement:
// ...
import "../metronic/core/index";
import "../metronic/app/layouts/demo1";
Edit vite.config.js File
vite.config.js file and update the file reference app.css to app.scss.
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.scss', 'resources/js/app.js'],
refresh: true,
}),
],
});
Create index.blade.php
index.html file from the metronic-tailwind-html/dist/html/demo1 directory and save it as index.blade.php in the resources/views folder. This will provide a starting point for your Laravel application.
You can ignore other assets paths for now.
index.blade.php file, add the following directives:
// ...
@vite('resources/css/app.scss')
</head>
// ...
@vite('resources/js/app.js')
</body>
Run Laravel Development Server
npm run dev
php artisan serve
http://localhost:8000 to see your Laravel app in action.