ClocxHD

less.php

Feb 5th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.         $inputFile = "style/style.less";
  3.         $outputFile = "style/style.css";
  4.  
  5.         $inputMenu = "style/menu.less";
  6.         $outputMenu = "style/menu.css";
  7.  
  8.         $inputFooter = "style/footer.less";
  9.         $outputFooter = "style/footer.css";
  10.  
  11.         $less = new lessc;
  12.  
  13.         // create a new cache object, and compile
  14.         $cache = $less->cachedCompile($inputFile);
  15.         file_put_contents($outputFile, $cache["compiled"]);
  16.  
  17.         $cache = $less->cachedCompile($inputMenu);
  18.         file_put_contents($outputMenu, $cache["compiled"]);
  19.  
  20.         $cache = $less->cachedCompile($inputFooter);
  21.         file_put_contents($outputFooter, $cache["compiled"]);
  22.  
  23.         // the next time we run, write only if it has updated
  24.         $last_updated = $cache["updated"];
  25.         $cache = $less->cachedCompile($cache);
  26.         if ($cache["updated"] > $last_updated) {
  27.             file_put_contents($outputFile, $cache["compiled"]);
  28.         }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment