# Interwebbi's Asset Inliner

Purpose-built plugin to inline local frontend CSS from WordPress enqueued styles.

## Features

- Replaces `<link rel="stylesheet">` output with inline `<style>` blocks for local files.
- Rewrites relative `url(...)` paths so assets (fonts/images) still resolve.
- Optional basic CSS minification.
- Optional Google Fonts localization:
  - Detects `fonts.googleapis.com` stylesheets
  - Downloads referenced font files to `/uploads/interwebbis-asset-inliner/`
  - Rewrites font URLs to local files and inlines the resulting CSS
- File-size guardrail (skip very large CSS files).
- Exclude specific style handles.

## Settings

Go to `Settings -> Interwebbi's Asset Inliner`.

- Enable inlining
- Minify inlined CSS
- Max file size (KB)
- Excluded handles (comma-separated)
- Localize Google Fonts
- Google Fonts display mode (`keep`, `swap`, `optional`, `fallback`, `block`)
- Preload localized WOFF2 fonts
- Google Fonts subsets allowlist (optional)
- Google Fonts weights allowlist (optional)
- Include italic Google Fonts variants toggle

## Notes

- Frontend only (admin/REST/feed requests are skipped).
- Includes stricter frontend gating so optimization only runs on true frontend page views.
- Logged-in administrators are bypassed on frontend requests.
- Local file resolution is restricted to allowed WordPress roots (uploads/content/includes) for safer path handling.
- Plugin-owned output buffer is explicitly closed on shutdown for safer compatibility in shared environments.
- External CSS URLs are not inlined.
- Default max file size is `200 KB`.
- If Google Fonts localization is enabled, first request may be slower while files are downloaded and cached.
- Use subset/weight filters to reduce the number of localized font files.
