dataDesk BLOG

Welcome to the blog of Mr.G

Nature
Posts: 4

Blog 1: Tailwind_3_CSS_-_CLI_+_local_build.md | (Open) | (Share)

▲ Previous | Next ▼

/Dev/Design/Tailwind

(Last modified: July 30 2025 23:27:27)

Tailwind 3 CSS - CLI + local build

A clean summary of how we got Tailwind CSS working without the CDN, using the CLI + local build setup:


✅ Your Working Tailwind Setup: Summary

1. Issue: Tailwind v4 didn't include the CLI binary

  • You tried installing Tailwind v4.x (^4.1.11)
  • npx tailwindcss init failed
  • node_modules/.bin/tailwindcss was missing
  • Confusion from missing docs/warnings

2. Fix: Downgraded to stable Tailwind v3.4.3

npm uninstall tailwindcss
npm install -D tailwindcss@^3.4.3 postcss autoprefixer

✅ This version includes the CLI (tailwindcss) binary


3. Initialized config files

npx tailwindcss init -p

Created:

  • tailwind.config.js
  • postcss.config.js

4. Created input file

src/input.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

5. Configured tailwind.config.js

content: [
  "./**/*.html",
  "./**/*.php",
  "./**/*.js",
  "!./node_modules/**/*", // ⛔ exclude unnecessary scanning
]

6. Replaced CDN with compiled CSS

From:

<script src="https://cdn.tailwindcss.com"></script>

To:

<link href="/dist/output.css" rel="stylesheet">

7. Built the Tailwind output

🔁 For development:

npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch

🛠 For one-time build:

npx tailwindcss -i ./src/input.css -o ./dist/output.css

✅ Result:

You now have a fully working, production-ready Tailwind setup, with:

  • Class scanning and purging
  • Local builds (fast, offline)
  • No bloat from unused CSS
  • Full customization support (themes, plugins)

Let me know if you want to:

  • Add minification for production builds
  • Add dark mode support
  • Set up a ready-to-deploy structure (with HTML/PHP)



Blog 2: DHH-Managers-are-useless---Leave-enginee_1753203515358.md | (Open) | (Share)

▲ Previous | Next ▼

/WebDAV/SyncPhone

(Last modified: July 22 2025 23:30:07)

DHH: Managers are useless - Leave engineers the hell alone | Lex Fridman Podcast Clips - YouTube

thumbnail
#menu">DHH: Managers are useless - Leave engineers the hell alone | Lex Fridman Podcast Clips - YouTube



Blog 3: Laravel-vs-Core-PHP_1753184273875.md | (Open) | (Share)

▲ Previous | Next ▼

/Dev/PHP

Last modified: July 22 2025 13:37:55

Laravel’s expressive, feature-rich layers come at the cost of some extra overhead compared to “plain” or “core” PHP. Below are several common scenarios where you’ll typically see Laravel slower than equivalent core-PHP code, along with illustrative examples:


1. Framework Bootstrapping & Routing

Why it’s slower:
Every request in Laravel must bootstrap the entire framework—load service providers, configuration, middleware, etc.—before even dispatching your route.

// core PHP (public/index.php)
$start = microtime(true);
if ($_SERVER['REQUEST_URI'] === '/hello') {
    echo 'Hello, world!';
}
$time = microtime(true) - $start;
error_log("core PHP boot + dispatch: {$time}");
# Laravel (public/index.php → handled by /routes/web.php)
Route::get('/hello', function () {
    return 'Hello, world!';
});

// Measured in public/index.php:
$start = microtime(true);
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
$response = $app->handle(
    $request = Illuminate\Http\Request::capture()
);
$response->send();
$app->terminate($request, $response);
$time = microtime(true) - $start;
error_log("Laravel boot + dispatch: {$time}");

Typical result:
– Core PHP: \~0.5 ms
– Laravel: \~10–20 ms

The bulk of that difference is framework initialization and routing logic.


2. Simple Database Queries: PDO vs Eloquent

Why it’s slower:
Eloquent adds layers (models, relationships, collections) that make each query more convenient—but heavier.

// core PHP using PDO
$pdo = new PDO($dsn, $user, $pass);
$start = microtime(true);
$stmt = $pdo->query('SELECT * FROM posts WHERE id = 1');
$post = $stmt->fetch(PDO::FETCH_ASSOC);
$time = microtime(true) - $start;
error_log("PDO query: {$time}");
// Laravel using Eloquent
use App\Models\Post;

$start = microtime(true);
$post = Post::find(1);
$time = microtime(true) - $start;
Log::info("Eloquent find: {$time}");

Typical result:
– PDO raw fetch: \~1 ms
– Eloquent → Model hydration: \~3–5 ms


3. Bulk Inserts

Why it’s slower:
Inserting many rows one-by-one with Eloquent invokes events, mass-assignment checks, and individual queries.

// core PHP bulk insert
$data = [];
for ($i = 0; $i < 1000; $i++) {
    $data[] = "(?, ?)";
    $bindings[] = "Title {$i}";
    $bindings[] = "Body {$i}";
}
$sql = "INSERT INTO posts (title, body) VALUES " . implode(',', $data);
$start = microtime(true);
$pdo->prepare($sql)->execute($bindings);
$time = microtime(true) - $start;
error_log("PDO bulk insert: {$time}");
// Laravel Eloquent looped insert
$start = microtime(true);
for ($i = 0; $i < 1000; $i++) {
    Post::create([
        'title' => "Title {$i}",
        'body'  => "Body {$i}",
    ]);
}
$time = microtime(true) - $start;
Log::info("Eloquent 1000× create: {$time}");

Typical result:
– PDO single bulk statement: \~15–30 ms
– Eloquent in a loop: \~800–1200 ms

Tip: For large datasets in Laravel, use the query builder’s insert() with a batch array:

Post::insert($arrayOf1000Rows);

4. View Rendering

Why it’s slower:
Blade templates are compiled to PHP then rendered, and include features like sections, inheritance, and directives.

// core PHP simple include
$start = microtime(true);
extract(['name' => 'Alice']);
include 'views/hello.php';  // just: <?php echo "Hello, $name"; ?>
$time = microtime(true) - $start;
error_log("PHP include view: {$time}");
// Laravel Blade
// resources/views/hello.blade.php
// Hello, {{ $name }}

$start = microtime(true);
return view('hello', ['name' => 'Alice']);
$time = microtime(true) - $start;
Log::info("Blade render: {$time}");

Typical result:
– PHP include: \~0.2 ms
– Blade render: \~2–4 ms


5. Middleware Pipeline

Why it’s slower:
Each middleware class adds a function call and possibly logic (authentication, CSRF, logging, etc.) before reaching your controller.



Blog 4: php_in_html_..._endif.md | (Open) | (Share)

▲ Previous

/Dev/HowTo/PHP

(Last modified: July 06 2025 18:56:10)

php in html ... endif


<?php if($this->value): ?>
Hello
<?php elseif($this->asd): ?>
Your name is: <?= $this->name ?>
<?php else: ?>
You don't have a name.
<?php endif; ?>


Who I am

"Just me, myself, and I, exploring the universe of unknownment, embracing the mystery of what lies beyond, one star at a time."

Share this page on Facebook | X.com | Reddit

Page Content

  • Image Tailwind 3 CSS - CLI + local build
    Published: 2025-07-30
    Read
  • Image DHH-Managers-are-useless---Leave-enginee 1753203515358
    Published: 2025-07-23
    Read
  • Image Laravel-vs-Core-PHP 1753184273875
    Published: 2025-07-22
    Read
  • Image php in html ... endif
    Published: 2025-07-06
    Read

Tags

WebDev New York London AI NORWAY DIY Ideas Life Family News Clothing Invest Sports Health