简体   繁体   中英

Minimize javascript code

I am only new to javascript. I am using minify to minimize load time of CSS and JS files. I also compress the javascript in my HTML document (functions) using jscompress I am wondering if it was possible to even minimize the functions? I am running ajax updates so in my HTML document I don't want my linked PHP files listed.

Is there a way to minimize the function codes found in the HTML using minify or another alternative method to do this? Thanks.

Yes, you can extract the javascript code found in your html pages into a separate file.

Wherever you are referencing php code like this <?php echo var_name ?> or something of that sort, send that as parameters into the appropriate "functions" in the new js file.

Now, process this newly created js file through the compression library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM