In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what is the WordPress plug-in for the merger of CSS and JS, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
We usually consider merging multiple CSS or JS into one file output. To solve this problem, I wrote this WordPress plug-in to achieve this purpose in WordPress.
Realization principle
If you have read my previous "PHP merge compressed css output Modular css Writing", you can first understand some of my handling of cache files, as well as some ideas about merging files and compressing code. The implementation principle of this plug-in is basically similar to that described in the above article.
Installation
First, download the plug-in, which I host on my GitHub, which you can download from this page. After downloading, unzip it, and upload the unzipped folder directly to your WordPress plugin directory. Then go backstage to enable it.
Use
Enter the background, under the "Settings" menu, there is a submenu "Minify", after entering, you can set its various options, and there are comments, you can understand the function.
To use wp-minify, you have to modify the theme because you output css and js differently. In your theme, delete the original CSS and JS output and output JS using the following method:
The method of outputting css is the same, except that you use another function, wp_minify_css (). The argument to the function is an array, and the elements inside the array are the path to the script file, which is written to the full relative path at the root of the WordPress installation directory.
Why write a script relative to the root directory of WordPress? Instead of relative to your current theme catalog? In fact, the reason is very simple, because the css or js you quote is not necessarily under the theme directory, sometimes you will refer to the styles or scripts under other directories. Of course, this is a relative path, and you can even reference a script from a directory above WordPress, such as "/.. / test.js", but note that the script must start with /, otherwise it may cause relative path errors.
Of course, the specific method of use can be easily modified or developed by yourself after you understand the principle.
This is the end of the WordPress plug-in on what is the merger of CSS and JS. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.