Skip to content

javascript 과 css 파일 결합 압축하여 페이지 속도 올리기

MintState November 10, 2008 at 1:34 PM Views 15692

javascript 과 css 파일 결합 압축하여 페이지 속도 올리기

Make your pages load faster by combining and compressing javascript and css files

브라우저가 한정된 수만을 동시에 전송하는데에서 착안하여 prototype 과 scriptaculous 와 같이 큰파일들을 서로 묶어서 전송하는 방법 입니다.

Take for example the following URLs:
http://www.creatype.nl/javascript/prototype.js
http://www.creatype.nl/javascript/builder.js
http://www.creatype.nl/javascript/effects.js
http://www.creatype.nl/javascript/dragdrop.js
http://www.creatype.nl/javascript/slider.js

You can combine all these files to a single file by simply changing the URL to:
http://www.creatype.nl/javascript/prototype.js,builder.js,effects.js,dragdrop.js,slider.js

같은 방업으로 css도 적용 시킬 수 있습니다.
combine.php 피일을 다운 받은후 ROOT 폴더에 업로드 하고 ROOT 폴더에 cache 디렉토리를 만들고 퍼미션을 777로 조정 하세요.
다음으로 RewriteRule 적용 하시면 됩니다.

.htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^css/(.*\.css) /combine.php?type=css&files=$1
RewriteRule ^javascript/(.*\.js) /combine.php?type=javascript&files=$1

Attachments

Share X Facebook LINE QR code

0 comments

Be the first to comment.