PHP code example of tonysm / tailwindcss-laravel

1. Go to this page and download the library: Download tonysm/tailwindcss-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tonysm / tailwindcss-laravel example snippets




namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /** ... */
    protected $middlewareGroups = [
        'web' => [
            // ...
            \Tonysm\TailwindCss\Http\Middleware\AddLinkHeaderForPreloadedAssets::class,
        ],

        'api' => [
            // ...
        ],
    ];

    // ...
}

    // ...
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->web(append: [
            \Tonysm\TailwindCss\Http\Middleware\AddLinkHeaderForPreloadedAssets::class,
        ]);
    })
    // ...



namespace Tests;

use Exception;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Tonysm\TailwindCss\Testing\InteractsWithTailwind;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;
    use InteractsWithTailwind;

    protected function setUp(): void
    {
        parent::setUp();

        $this->withoutTailwind();
    }
}



namespace Tests;

use Exception;
use Tests\TestCase;
use Tonysm\TailwindCss\Testing\InteractsWithTailwind;

class ExampleTest extends TestCase
{
    use InteractsWithTailwind;

    /** @test */
    public function throws_exception_when_manifest_is_missing()
    {
        $this->expectException(Exception::class);

        $this->withoutExceptionHandling()
            ->get(route('login'));

        $this->fail('Expected exception to be thrown, but it did not.');
    }

    /** @test */
    public function can_disable_tailwindcss_exception()
    {
        $this->withoutTailwind()
            ->get(route('login'))
            ->assertOk();
    }
}
bash
php artisan tailwindcss:install
bash
php artisan vendor:publish --tag="tailwindcss-config"
bash
php artisan tailwindcss:download
bash
php artisan tailwindcss:install
bash
php artisan tailwindcss:build
bash
php artisan tailwindcss:build --digest
bash
php artisan tailwindcss:build --minify
bash
php artisan tailwindcss:build --prod
bash
php artisan tailwindcss:watch
bash
php artisan tailwindcss:build --prod
bash
php artisan tailwindcss:download
php artisan tailwindcss:build --prod