[WordPress] 外掛分享: Remove CSS link IDs

首頁外掛目錄 › Remove CSS link IDs
30+
安裝啟用
★★★★★
5/5 分(1 則評價)
4094 天前
最後更新
問題解決
WordPress 3.8+ v1.0.1 上架:2014-05-09

內容簡介

這個簡單的外掛程式會連接到 wp_enqueue_scripts 並移除 id='<handle of the css file>-css' 屬性。大部分情況下,您並不需要這些 ID。

我在我的伺服器上使用了 mod_pagespeed 模組,如果 <link> 標籤擁有 ID 屬性,combine_css 過濾器就會失效。因此,根據這篇部落格文章,我創建了一個非常簡單的 (基本上只有一行程式碼) 單純移除 ID 屬性的外掛程式。

此外,這個外掛程式還有一個簡單的單元測試,可以使用 wp-cli 創建: wp scaffod plugin ...。

祝您網站速度加快!🙂

您想要貢獻嗎?太棒了!請 fork 這個儲存庫,進行更改並建立 pull 要求。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Remove CSS link IDs」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This simple plugin hooks to the wp_enqueue_scripts and removed the id='-css' attribute. Most of the time you don’t need these IDs anyway.
I am using the mod_pagespeed module on my server and the combine_css filter doesn’t work if the tags have ID attributes. So based on this blog post I created a very very simple (basically one-liner) plugin that removes the ID attribute using regex.
There is also a very simple unit test for it, created using wp-cli: wp scaffod plugin ....
Enjoy the speedy sites! 🙂
Do you want to contribute? Great! Please fork this repository, make the changes and create a pull request.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon