开发者

Automatically Pack Javascript/CSS from Amazon S3?

开发者 https://www.devze.com 2023-03-11 12:23 出处:网络
I\'m moving my javascript and css files to Amazon S3 - can anyone suggest an efficient way to automatically pack/minimize the files without defeating the purpose of hosting them on S3?

I'm moving my javascript and css files to Amazon S3 - can anyone suggest an efficient way to automatically pack/minimize the files without defeating the purpose of hosting them on S3?

Atm, I have my javascript files being called in this manner:

<script type="text/javascript" src="myjavascript.js.php"></script>

Where the php file finds myjavascript.js, packs it, saves the packed js (myjavascript_min.js) into a separate folder, and returns it. This doesn't seem very efficient, even though it only goes through the packing process if either myjavasc开发者_如何学编程ript_min.js doesn't exist or myjavascript.js has been modified after myjavascript_min.js was last generated.

Any help appreciated!


Sounds like you need a build script that packs, minifies and pushes to S3 each time a new copy is pushed live. Change all your references to the minified versions on S3 and you should be good to go.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号