]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Use string-replace and copy partials over
authorJoao Mesquita <jmesquita@indicium.com.ar>
Fri, 21 Aug 2015 22:12:28 +0000 (19:12 -0300)
committerJoao Mesquita <jmesquita@indicium.com.ar>
Fri, 21 Aug 2015 22:33:25 +0000 (19:33 -0300)
html5/verto/verto_communicator/Gruntfile.js
html5/verto/verto_communicator/index.html
html5/verto/verto_communicator/js/verto-service.js
html5/verto/verto_communicator/package.json

index 0cbf3d4475e314cfac3a4e5025c18feb7d180ca5..cd900b4a2023257add45b9331b85b31df94abb8d 100644 (file)
@@ -20,7 +20,7 @@ module.exports = function (grunt) {
     dist: 'dist'
   };
 
-  var ip = grunt.option('ip') || 'localhost';
+  var ip = grunt.option('ip');
 
   // Project configuration.
   grunt.initConfig({
@@ -35,7 +35,7 @@ module.exports = function (grunt) {
       },
       js: {
         files: ['js/verto-service.js'],
-        tasks: ['includereplace:dev']
+        tasks: ['string-replace:dev']
       },
       styles: {
         files: ['<%= config.app %>/css/{,*/}*.css'],
@@ -47,25 +47,20 @@ module.exports = function (grunt) {
     },
 
     // Replace so we can have it properly passed from dev
-    includereplace: {
+    'string-replace': {
       dev: {
-        options: {
-          globals: {
-            ip: ip
-          },
+        files: {
+          '.tmp/js/verto-service.js': '<%= config.app %>/js/verto-service.js'
         },
-        src: 'js/verto-service.js',
-        dest: '.tmp/js/verto-service.js'
-      },
-      prod: {
         options: {
-          globals: {
-            ip: ip
-          },
-        },
-        src: 'js/verto-service.js',
-        dest: 'dist/js/'
-      }      
+          replacements: [
+            {
+              pattern: 'window.location.hostname',
+              replacement: ip
+            }
+          ]
+        }
+      }
     },
     wiredep: {
       app: {
@@ -87,9 +82,9 @@ module.exports = function (grunt) {
       dist: {
         files: [{
           expand: true,
-          cwd: '.tmp/styles/',
+          cwd: '.tmp/css/',
           src: '{,*/}*.css',
-          dest: '.tmp/styles/'
+          dest: '.tmp/css/'
         }]
       }
     },
@@ -120,6 +115,15 @@ module.exports = function (grunt) {
           }
         }
       },
+      dist: {
+        options: {
+          port: 9001,
+          background: false,
+          server: {
+            baseDir: ['dist']
+          }
+        }
+      }
     },
 
     jshint: {
@@ -206,28 +210,34 @@ module.exports = function (grunt) {
       }
     },
 
-    htmlmin: {
-      dist: {
-        options: {
-          collapseBooleanAttributes: true,
-          collapseWhitespace: true,
-          conservativeCollapse: true,
-          removeAttributeQuotes: true,
-          removeCommentsFromCDATA: true,
-          removeEmptyAttributes: true,
-          removeOptionalTags: true,
-          // true would impact styles with attribute selectors
-          removeRedundantAttributes: false,
-          useShortDoctype: true
-        },
-        files: [{
-          expand: true,
-          cwd: '<%= config.dist %>',
-          src: '{,*/}*.html',
-          dest: '<%= config.dist %>'
-        }]
-      }
-    },
+    // htmlmin: {
+    //   dist: {
+    //     options: {
+    //       collapseBooleanAttributes: true,
+    //       collapseWhitespace: true,
+    //       conservativeCollapse: true,
+    //       removeAttributeQuotes: true,
+    //       removeCommentsFromCDATA: true,
+    //       removeEmptyAttributes: true,
+    //       removeOptionalTags: true,
+    //       // true would impact styles with attribute selectors
+    //       removeRedundantAttributes: false,
+    //       useShortDoctype: true
+    //     },
+    //     files: [{
+    //       expand: true,
+    //       cwd: '<%= config.dist %>',
+    //       src: '{,*/}*.html',
+    //       dest: '<%= config.dist %>'
+    //     },
+    //     {
+    //       expand: true,
+    //       cwd: '<%= config.dist %>/partials',
+    //       src: '{,*/}*.html',
+    //       dest: '<%= config.dist %>/partials'
+    //     }]
+    //   }
+    // },
      // ng-annotate tries to make the code safe for minification automatically
      // by using the Angular long form for dependency injection.
      ngAnnotate: {
@@ -251,6 +261,7 @@ module.exports = function (grunt) {
            src: [
              '*.{ico,png,txt}',
              '*.html',
+             'partials/**/*.html',
              'images/{,*/}*.{webp}',
              'css/fonts/{,*/}*.*'
            ]
@@ -264,6 +275,11 @@ module.exports = function (grunt) {
            cwd: 'bower_components/bootstrap/dist',
            src: 'fonts/*',
            dest: 'dist'
+         }, {
+           expand: true,
+           cwd: 'bower_components/bootstrap-material-design/dist',
+           src: 'fonts/*',
+           dest: 'dist'
          }]
        },
        styles: {
@@ -286,13 +302,23 @@ module.exports = function (grunt) {
      },
   });
 
-  grunt.registerTask('serve', ['clean:server',
+  grunt.registerTask('serve', function (target) {
+    var tasks = ['clean:server',
       'wiredep',
       'concurrent:server',
-      'postcss',
-      'includereplace:dev',
+      'postcss'];
+
+    if (ip) {
+      tasks = tasks.concat(['string-replace:dev',
       'browserSync:livereload',
       'watch']);
+    } else {
+      tasks = tasks.concat(['browserSync:livereload',
+      'watch']);
+    }
+    
+    grunt.task.run(tasks);
+  });
   
   grunt.registerTask('build', [
     'clean:dist',
@@ -307,7 +333,7 @@ module.exports = function (grunt) {
     'copy:dist',
     'filerev',
     'usemin',
-    'htmlmin'
+    // 'htmlmin'
   ]);
 
 };
index c284bd4bb74a1813bfe5e0f81ba8a89a1a9de128..d912540a938586e1a200e39dde95510d0da73c79 100644 (file)
@@ -23,7 +23,7 @@
     <!-- endbuild -->
 
     <!-- CSS -->
-    <!-- build:css(.tmp) css/main.css -->
+    <!-- build:css(.) css/verto.css -->
     <link rel="stylesheet" type="text/css" href="css/verto.css">
     <!-- endbuild -->
 
index 01e4e610497f6635bc262b0a48ebf729fe58e2fe..87b93b73f3f9ad5d36d9b704d20929a326c15a95 100644 (file)
@@ -117,8 +117,8 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
       textTo: $cookieStore.get('verto_demo_textto') || "1000",
       login: $cookieStore.get('verto_demo_login') || "1008",
       password: $cookieStore.get('verto_demo_passwd') || "1234",
-      hostname: $cookieStore.get('verto_demo_hostname') || '@@ip',
-      wsURL: $cookieStore.get('verto_demo_wsurl') || ("wss://" + '@@ip' + ":8082"),
+      hostname: $cookieStore.get('verto_demo_hostname') || window.location.hostname,
+      wsURL: $cookieStore.get('verto_demo_wsurl') || ("wss://" + window.location.hostname + ":8082"),
       useVideo: $cookieStore.get('verto_demo_vid_checked') || true,
       useCamera: $cookieStore.get('verto_demo_camera_checked') || true,
       useStereo: $cookieStore.get('verto_demo_stereo_checked') || true,
index 61e924189e3210f59c211c94f3460e6adfadc96f..3ffd8379d1af7d4157ac25bff10ff41c292f4738 100644 (file)
@@ -3,10 +3,10 @@
   "version": "0.0.1",
   "description": "HTML5 Based Communications application for use with FreeSWITCH and mod_verto",
   "devDependencies": {
-    "grunt-browser-sync": "^2.1.2",
-    "browser-sync": "^2.8.2",
     "autoprefixer-core": "^5.2.1",
+    "browser-sync": "^2.8.2",
     "grunt": "^0.4.5",
+    "grunt-browser-sync": "^2.1.2",
     "grunt-concurrent": "^1.0.0",
     "grunt-contrib-clean": "^0.6.0",
     "grunt-contrib-concat": "^0.5.0",
     "grunt-contrib-htmlmin": "^0.4.0",
     "grunt-contrib-imagemin": "^0.9.2",
     "grunt-contrib-jshint": "^0.11.0",
-    "grunt-postcss": "^0.5.3",
     "grunt-contrib-uglify": "^0.7.0",
     "grunt-contrib-watch": "latest",
     "grunt-filerev": "^2.1.2",
-    "grunt-include-replace": "^3.1.0",
     "grunt-newer": "^1.1.0",
     "grunt-ng-annotate": "^0.9.2",
+    "grunt-postcss": "^0.5.3",
+    "grunt-string-replace": "^1.2.0",
     "grunt-svgmin": "^2.0.0",
     "grunt-usemin": "^3.0.0",
     "grunt-wiredep": "^2.0.0",