You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/04/16 02:31:13 UTC

[09/11] git commit: Adding in preprocess directives to remove the livereload script on pushing out to prod

Adding in preprocess directives to remove the livereload script on pushing out to prod


Project: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/commit/8691cd96
Tree: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/tree/8691cd96
Diff: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/diff/8691cd96

Branch: refs/heads/master
Commit: 8691cd965c63e38dbb8ec646eeef65581d3502ef
Parents: 518e10e
Author: Josh Bavari <jo...@raisemore.com>
Authored: Tue Apr 8 17:13:08 2014 -0500
Committer: Josh Bavari <jo...@raisemore.com>
Committed: Tue Apr 8 17:13:08 2014 -0500

----------------------------------------------------------------------
 .gitignore             |  1 +
 Gruntfile.js           | 21 ++++++++++++++++++---
 attachments/index.html |  4 ++--
 package.json           |  3 ++-
 4 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/8691cd96/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 9daa824..6e3a08a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 .DS_Store
 node_modules
+tmp
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/8691cd96/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 8372351..506f80c 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -88,13 +88,23 @@ module.exports = function(grunt) {
       livereloadout: {
         options: {
           context: {
-            LIVERELOAD: true
+            PRODUCTION: true
           }
         },
         files: {
           'attachments/index.html' : 'attachments/index.html'
         }
       }
+    },
+    copy: {
+      after: {
+        src: './tmp/index.html',
+        dest: 'attachments/index.html'
+      },
+      before: {
+        src: 'attachments/index.html',
+        dest: './tmp/index.html'
+      }
     }
   });
   
@@ -113,15 +123,20 @@ module.exports = function(grunt) {
   grunt.registerTask('cloudant', function (target) {
       grunt.task.run([
           'less',
-          'preprocess:livereloadout',
+          'copy:before', //Copy index.html to tmp, to save the preprocess directives
+          'preprocess', //Preprocess out the livereload script.
+          'copy:after', //Copy index.html back to attachments, with the preprocess directives as seved.
           'shell:cloudant'   
       ]);
   });
   grunt.registerTask('iriscouch', function (target) {
       grunt.task.run([
           'less',
-          'preprocess:livereloadout',
+          'copy:before', //Copy index.html to tmp, to save the preprocess directives
+          'preprocess', //Preprocess out the livereload script.
+          'copy:after', //Copy index.html back to attachments, with the preprocess directives as seved.
           'shell:iriscouch'   
       ]);
   });
+  grunt.registerTask('pre', ['copy:before', 'preprocess']);
 };

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/8691cd96/attachments/index.html
----------------------------------------------------------------------
diff --git a/attachments/index.html b/attachments/index.html
index 094c1d4..c50d426 100644
--- a/attachments/index.html
+++ b/attachments/index.html
@@ -15,8 +15,8 @@
   <link href="css/styles.css" rel="stylesheet" type="text/css">
   <link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon">
 
-  <!-- @ifndef LIVERELOAD -->
-   <script src="http://localhost:35729/livereload.js"></script>
+  <!-- @ifndef PRODUCTION -->
+  <script src="http://localhost:35729/livereload.js"></script>
   <!-- @endif -->
 
 </head>

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/8691cd96/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 987d898..e8bf715 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
     "grunt-contrib-less": "~0.9.0",
     "grunt-connect-proxy": "^0.1.8",
     "grunt-contrib-connect": "^0.7.1",
-    "grunt-preprocess": "~4.0.0"
+    "grunt-preprocess": "~4.0.0",
+    "grunt-contrib-copy": "~0.5.0"
   }
 }