Dotclear

source: build-tools/min-js.php @ 1179:a43a29427ef3

Revision 1179:a43a29427ef3, 896 bytes checked in by franck <carnet.franck.paul@…>, 12 years ago (diff)

Update copyright notice

  • Property exe set to *
Line 
1#!/usr/bin/env php
2<?php
3# -- BEGIN LICENSE BLOCK ---------------------------------------
4#
5# This file is part of Dotclear 2.
6#
7# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
8# Licensed under the GPL version 2.0 license.
9# See LICENSE file or
10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11#
12# -- END LICENSE BLOCK -----------------------------------------
13
14try
15{
16     $js = (!empty($_SERVER['argv'][1])) ? $_SERVER['argv'][1] : null;
17     
18     if (!$js || !is_file($js)) {
19          throw new Exception(sprintf("File %s does not exist",$js));
20     }
21     
22     require dirname(__FILE__).'/jsmin-1.1.1.php';
23     
24     $content = file_get_contents($js);
25     $res = JSMin::minify($content);
26     
27     if (($fp = fopen($js,'wb')) === false) {
28          throw new Exception(sprintf('Unable to open file %s',$js));
29     }
30     fwrite($fp,$res);
31     fclose($fp);
32}
33catch (Exception $e)
34{
35     fwrite(STDERR,$e->getMessage()."\n");
36     exit(1);
37}
38?>
Note: See TracBrowser for help on using the repository browser.

Sites map