Some time ago I wrote a pop-up dialog box for js data verification, js email verification, js url verification, js length verification, and js digital verification. However, the unfriendly method is not very popular, so I wrote a new one, which is encapsulated better and sha
PHP implementation of the compression of multiple CSS and JS file method,
This paper describes the PHP implementation of the compression of multiple CSS and JS file method. Share to everyone for your reference. The implementation method is as follows:
1. Compress CSS
Copy the Code code as follows: Header (' content-type:text/css ');Ob_start ("compress");function Compress ($buffer) {/* Remove Comments */$bu
. style. cursor = "default ";
3. Document. Links get all links on the page
VaRLinks =Document. links;VaRArnames =[];For(VaRIInLinks) {arnames. Push (Links [I]);}For(VaRIInArnames) {document. Write (arnames [I]);}
Usage: Use the firebug plug-in of Firefox to run on the Sina homepage.
4. js onchange event, try throw catch for Form Verification
User Name Password Nbsp; Code
5. js shields all
This article mainly introduces how to compress multiple CSS and JS files in php, and how to compress css files and js files by using two complete examples, for more information about how to compress multiple CSS and JS files in php, see the following example. Share it with you for your reference. The specific implementation method is as follows:
1. compress css
multiple files in different directories into one file.6. Batch compress the entire directory. For example, if there are several files in the directory, you only need to fill in the directory path to automatically traverse the files in the directory and use each file name +. min. format of the suffix to generate compressed files7. compress the resource files in the entire directory and merge them into a. min file in the specified path.8. During local batch compression of the entire directory, th
A period of time ago wrote a JS data validation, JS email verification, JS URL verification, JS length verification, JS digital verification, such as pop-up dialog box form but, now not very popular kind of very unfriendly way, so rewrite a, packaged better, more friendly la
I have been working on the web for some time. I want to share with you some experiences in loading JS files on the web.
1. First, let's talk about merging and compressing JS files.
To facilitate centralized management of JS merge and compression, we create a JS. ashx file to specifically handle merge compression. Here
(' client/js/**/*.js ')//Match ' client/js/somedir/somefile.js ' now the value of ' base ' is ' client/js/'. Pipe (Minify ()). Pipe (guLp.dest (' build ')); Write ' build/somedir/somefile.js ' to replace ' client/js/' with Build
This article mainly introduces four js key points that Node. JS developers must understand. Node. js is a server-oriented framework based on Chrome's powerful V8JS engine. Although it is compiled by C ++, it and its applications run on JS. If you need it, you can refer to this article to summarize four Node.
About the difference between node. js and JavaScript, you know? Do you know about the similarities between node. js and JavaScript? If you do not know, then don't come to see this article, you are still waiting for what, see now
First, let's look at the comparison between JS and node. JS:
Javascript:
ECMAScript (langu
jsmin class:
This instance comes from:
The Code is as follows:
Header ('content-type: text/javascript ');Require 'jsmin. php ';Echo JSMin: minify (file_get_contents ('common. js'). file_get_contents ('common2. js '));
The jsmin. php file is as follows:
The Code is as follows:
/*** Jsmin. php-PHP implementation of Douglas Crockford's JSMin.** This is pretty muc
Use UglifyJS under node to compress and merge JS files, nodeuglifyjs
Currently, the latest version of UglifyJS is 2.8.13. The main function is JavaScript compression and merging. Go to the tutorial below:
Installation:
Install uglifyjs as a global variable so that you can use it anywhere.
# UglifyJS2 usage
> Two methods are available for UglifyJS2.
1. shell Command call
2. api call
Shell command:
Merge and compress the start.
Use gulp to compress html, js, css, and images of the project,1, download and install node access http://nodejs.org, and then click the big greeninstallClick to directly run the program after the download is complete, and everything is ready. Npm will be installed along with the installation package. 2. Open the code line.Node-v // view the node version. if the version is displayed, the installation is successful.npm -v //Check the npm version. if t
Merging and compressing JS, CSS filesCompressing the Js,css file requires referencing the following components:GULP-MINIFY-CSS: Compressing CSSGulp-jshint: Check JSGulp-uglify: Compression jsGulp-concat: Merging FilesGulp-rename: Renaming filesGulp-clean: Empty FolderGulp-notify: TipsInstall the Component project directory, enter the project's root directory via
entire directory in-place batch compression, such as the directory has a number of files, just fill in the directory path, you can automatically traverse the directory files, and in each filename +.min. suffix format to generate the compressed file7. After compressing the entire directory's resource files, merge them into a. min file of a specified path8, the entire directory in-place batch compression, automatically ignore. min file, prevent duplicate compression
Use:1. Copy the suminify_php_1
://www.php1.cn/
The code is as follows:
Header ('content-type: text/javascript ');Require 'jsmin. php ';Echo JSMin: minify (file_get_contents ('Common. js'). file_get_contents ('common2. js '));
The jsmin. php file is as follows:
The code is as follows:
* @copyright 2002 Douglas Crockford
(jsmin.c) * @copyright 2008 Ryan Grove
(PHP port) * @copy
directory in-place batch compression, such as the directory has a number of files, just fill in the directory path, you can automatically traverse the directory files, and in each filename +.min. suffix format to generate the compressed file7. After compressing the entire directory's resource files, merge them into a. min file of a specified path8, the entire directory in-place batch compression, automatically ignore. min file, prevent duplicate compressionUse:1. Copy the suminify_php_1_5 file
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.