JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
use local less.js when running locally
authorJason Woofenden <jason@jasonwoof.com>
Mon, 19 Sep 2011 04:54:55 +0000 (00:54 -0400)
committerJason Woofenden <jason@jasonwoof.com>
Mon, 19 Sep 2011 04:54:55 +0000 (00:54 -0400)
run.php now tem_set()s $running_locally if the host name ends with ".l" or is
an is an ipv4 adress.

metaform/site-template.html
run.php

index 0298f9c..7415d56 100644 (file)
@@ -8,7 +8,8 @@
        <![endif]-->
        <script>less = {env:'development'};</script>
        <link rel="stylesheet/less" href="style_01.less" />
-       <script src="http://lesscss.googlecode.com/files/less-1.0.41.min.js"></script>
+       <!--~$running_locally {~--><script src="/javascript/less/less.min.js"></script><!--~}~-->
+       <!--~$running_locally unset {~--><script src="http://lesscss.googlecode.com/files/less-1.0.41.min.js"></script><!--~}~-->
        <!--~$head~-->
 </head>
 
diff --git a/run.php b/run.php
index 2791852..60e4eab 100644 (file)
--- a/run.php
+++ b/run.php
@@ -89,7 +89,10 @@ function run_php($dest = false) {
        if(file_exists('template.html')) {
                $GLOBALS['wfpl_main_template'] = new tem();
                $GLOBALS['wfpl_main_template']->load("template.html");
-               $GLOBALS['wfpl_main_template']->set('wfpl_basename', $basename);
+               $GLOBALS['wfpl_main_template']->set('$basename', $basename);
+               if(preg_match('/([.]l(ocal)?$)|^[0-9.]*$/', $_SERVER['HTTP_HOST'])) {
+                       $GLOBALS['wfpl_main_template']->set('$running_locally');
+               }
        }
 
        # cms_get can return one of: