In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use the WordPress plug-in combined with CSS and JS. I hope you will get something after reading this article. Let's discuss it together.
What are the selectors of css? css selectors can be divided into three categories, namely, id selector, class selector and tag selector. There can be many combinations between them, such as descendant selector, sub-selector, pseudo-class selector, general selector, group selector, and so on.
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.
After reading this article, I believe you have a certain understanding of "how to use the WordPress plug-in for the merger of CSS and JS". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.