=== Easy Critical CSS === Contributors: criticalcss Tags: critical css, performance, optimization, speed, lighthouse Requires at least: 6.2 Tested up to: 6.8.1 Requires PHP: 7.4 Stable tag: trunk License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Easily inject Critical CSS and optimized Secondary CSS to improve page speed and performance. == Description == Easy Critical CSS is a lightweight WordPress plugin that allows you to add Critical CSS to any page on your site, improving your site's loading speed and performance. **Features:** - Easily add **Critical CSS** and **Secondary CSS** to any page - **Secondary CSS** removes all unused stylesheets, ensuring only a single optimized CSS file loads - Supports **posts, pages, archives, and taxonomy pages** - Fully **compatible with caching plugins** (WP Rocket, W3 Total Cache, WP Super Cache, etc.) - **Customizable settings** for individual pages - **Background processing** to prevent performance impact - **Optional API service** (*API key required*) for automated Critical & Secondary CSS generation ### Why Use Critical CSS? Critical CSS ensures that essential styles for above-the-fold content load first, reducing render-blocking and **boosting Core Web Vitals**, page speed, and SEO rankings. == Installation == = Install via WordPress = 1. Visit **Plugins** > **Add New**. 2. Search for **Easy Critical CSS**. 3. Click **Install Now**, then **Activate**. = Manual installation = 1. Download the plugin ZIP file. 2. Upload it to `/wp-content/plugins/` via FTP or WordPress plugin upload. 3. Activate it from the **Plugins** menu. == External services == This plugin interacts with external third-party services in order to provide its functionality. Below is a detailed breakdown of these interactions: 1. **Critical CSS API (api.criticalcss.net)** This service generates critical and secondary CSS used to optimize your site's CSS delivery and improve page load times. - **Data Sent**: The URL, CSS generation preferences, generation status, and HTML content of pages from your website. - **When**: Data is transmitted only if you have explicitly enabled the Auto generation mode, and occurs whenever Critical CSS or Secondary CSS needs to be generated or regenerated. - **Links**: [Terms of Service](https://criticalcss.net/terms/), [Privacy Policy](https://criticalcss.net/privacy/). 2. **Cloudflare API (api.cloudflare.com)** This service is used to automatically clear your Cloudflare cache after new critical CSS is generated, ensuring your visitors see updated styles immediately. - **Data Sent**: Authentication credentials (Cloudflare email, API key, and zone ID) and instructions for purging the cache. - **When**: Data is sent only if `CLOUDFLARE_EMAIL`, `CLOUDFLARE_API_KEY`, and `CLOUDFLARE_ZONE_ID` are defined in your site's configuration. - **Links**: [Terms of Service](https://www.cloudflare.com/terms/), [Privacy Policy](https://www.cloudflare.com/privacypolicy/). 3. **Kinsta Cache Clear (localhost)** If your site is hosted on Kinsta, this plugin can trigger a cache clear after generating new critical CSS, ensuring immediate availability of updated styles. - **Data Sent**: A cache-clear request to your site's local server endpoint provided by Kinsta. No sensitive or identifying information is transmitted beyond the local environment. - **When**: Data is sent only when your site detects that it’s running on Kinsta infrastructure (`KINSTA_CACHE_ZONE` environment variable is present). - **Links**: [Kinsta Terms of Service](https://kinsta.com/legal/terms-service/), [Kinsta Privacy Policy](https://kinsta.com/legal/privacy-policy/). 4. **Freemius API (api.freemius.com and wp.freemius.com)** Used to manage licensing, validate API keys, and handle plugin updates and account management. - **Data Sent**: Freemius sends and receives licensing information and plugin activation status, including your site's URL, plugin version, API key, and licensing details. - **When**: Data is transmitted only after explicitly opting in through the plugin's settings page or upon activation of a purchased API key. By default, the plugin does not send any data to Freemius. - **Links**: [Freemius Terms of Service](https://freemius.com/terms/), [Freemius Privacy Policy](https://freemius.com/privacy/). == Frequently Asked Questions == = Does Easy Critical CSS work with caching plugins? = Yes! It integrates with popular caching plugins and clears their cache when new Critical CSS is applied. = Can I exclude specific CSS files? = Yes, the plugin allows you to specify **CSS files to exclude** from removal. = How does the plugin generate Critical CSS? = The plugin extracts Critical CSS using an **API-based service (API key required)**. It scans your page, isolates the above-the-fold styles, and **removes unused selectors**, optimizing CSS size and performance. = Can I use this without an API key? = Absolutely! You can manually add a **default Critical CSS** that applies to all pages. Additionally, you can **override** it per page with custom Critical CSS and use **Secondary CSS** to remove unnecessary stylesheets. = Where is Critical CSS stored? = By default, Critical CSS and Secondary CSS are stored in your site's database. However, you can enable the **"Serve Critical CSS from Files"** option, which will save optimized CSS to static files inside `/wp-content/uploads/easy-critical-css/`. This can improve performance by reducing database load and serving CSS faster through your web server. *Note: This setting applies only to auto-generated Critical CSS.* = Is it safe to uninstall the plugin? = Yes. If you choose the **"Delete All Data"** option under settings before uninstalling, all plugin settings and Critical CSS will be permanently removed from your site. If you simply deactivate or delete without using the uninstall option, your data will be preserved. = Does Easy Critical CSS work with block themes and Full Site Editing? = Yes, Easy Critical CSS is fully compatible with block-based themes and Full Site Editing (FSE) in WordPress 6.2 and above. == Changelog == = 1.0.0 = - Initial release - FEATURE: Manual Critical CSS adding - FEATURE: Automated Critical CSS generation through API - FEATURE: Integration with popular caching plugins = 1.0.1 = - FIX: Prevents feeds from auto generating Critical CSS = 1.0.2 = - FIX: Fixes logic when outputting Secondary CSS - FIX: Prevents 404 pages from auto generating Critical CSS