style.css.php > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

style.css.php 정보

style.css.php

본문

css 내용이 많거나 파일이 나누어져있을때 코드압축..

style.css.php
---------------
<?php
  header('Content-type: text/css');
  ob_start("compress");
  function compress($buffer) {
    /* remove comments */
    $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
    /* remove tabs, spaces, newlines, etc. */
    $buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $buffer);
    return $buffer;
  }
  /* your css files */
  include_once "style.css";
  ob_end_flush();
?>

이렇게 하고
<link rel="stylesheet" href="<?=$g4['path']?>/style.css.php" type="text/css" />
요로크롬 불러주시면 됩니다.~ JS도 비슷한방법으로 ~~


http://egghyun.playcast.kr/style.css.php?compression<-소스보기 ㄱㄱ

추천
8
  • 복사

댓글 9개

디자인을css로 만 한다면 많은 효과를 볼수있어요~ 여기다가 css.php 캐쉬파일을 생성하게하고 캐쉬파일이 존재하면 기존 캐쉬파일을 불러와 읽게 하면 좋아요~
© SIRSOFT
현재 페이지 제일 처음으로