From f0f215ad5b42933c56347a6e6e4845df61e864a7 Mon Sep 17 00:00:00 2001 From: Mario Volke Date: Mon, 27 Oct 2014 15:02:19 +0100 Subject: [PATCH 1/3] angular template minification Conflicts: Gruntfile.js --- Gruntfile.js | 29 +++++++++++++++++++++++++---- package.json | 3 ++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3656fa2..f131449 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -30,7 +30,7 @@ module.exports = function(grunt) { clean: { dist: ['dist', 'compile', 'test/lib', 'test/integration/src'], - release: ['dist/**/*.browserified.js', 'dist/**/*.js.map'] + release: ['dist/**/*.browserified.js', 'dist/**/*.js.map', 'dist/js/app.templates.js'] }, copy: { @@ -74,7 +74,7 @@ module.exports = function(grunt) { tpl: { expand: true, cwd: 'src/tpl/', - src: ['*'], + src: ['read-sandbox.html'], dest: 'dist/tpl/' }, app: { @@ -231,6 +231,22 @@ module.exports = function(grunt) { } }, + ngtemplates: { + mail: { + src: [ + 'tpl/**/*.html' + ], + dest: 'dist/js/app.templates.js', + cwd: 'src/', + options: { + htmlmin: { + collapseWhitespace: true, + removeComments: true // we do not use comment directives + } + } + } + }, + concat: { options: { separator: ';\n', @@ -249,7 +265,8 @@ module.exports = function(grunt) { 'src/lib/lawnchair/lawnchair-git.js', 'src/lib/lawnchair/lawnchair-adapter-webkit-sqlite-git.js', 'src/lib/lawnchair/lawnchair-adapter-indexed-db-git.js', - 'dist/js/app.browserified.js' + 'dist/js/app.browserified.js', + '<%= ngtemplates.mail.dest %>' ], dest: 'dist/js/app.min.js', options: { @@ -498,6 +515,8 @@ module.exports = function(grunt) { 'appcache.manifest', 'manifest.webapp', 'manifest.mobile.json', + 'background.js', + 'js/app.templates.js', 'js/app.js.map', 'js/app.min.js.map', 'js/app.browserified.js', @@ -540,16 +559,18 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-svgmin'); grunt.loadNpmTasks('grunt-svgstore'); grunt.loadNpmTasks('grunt-shell'); + grunt.loadNpmTasks('grunt-angular-templates'); // Build tasks grunt.registerTask('dist-css', ['sass', 'autoprefixer', 'csso']); - grunt.registerTask('dist-js', ['browserify', 'exorcise', 'concat', 'uglify']); + grunt.registerTask('dist-js', ['browserify', 'exorcise', 'ngtemplates', 'concat', 'uglify']); grunt.registerTask('dist-js-app', [ 'browserify:app', 'browserify:pbkdf2Worker', 'browserify:mailreaderWorker', 'browserify:tlsWorker', 'exorcise:app', + 'ngtemplates', 'concat:app', 'concat:readSandbox', 'concat:pbkdf2Worker', diff --git a/package.json b/package.json index f2e48cf..c4910b8 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "crypto-lib": "~0.2.1", "dompurify": "~0.4.2", "grunt": "~0.4.1", + "grunt-angular-templates": "~0.5.7", "grunt-autoprefixer": "~0.7.2", "grunt-browserify": "^3.0.1", "grunt-contrib-clean": "~0.5.0", @@ -72,4 +73,4 @@ "time-grunt": "^1.0.0", "wo-smtpclient": "~0.5.0" } -} +} \ No newline at end of file From b5e305534e148b45bf2f9fca7a1443ac21789cf1 Mon Sep 17 00:00:00 2001 From: Mario Volke Date: Tue, 2 Dec 2014 16:26:37 +0100 Subject: [PATCH 2/3] trigger ngtemplates on template change in watch task --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index f131449..4d31d0d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -464,7 +464,7 @@ module.exports = function(grunt) { tasks: ['dist-css', 'manifest'] }, jsApp: { - files: ['src/js/**/*.js'], + files: ['src/js/**/*.js', 'src/**/*.html'], tasks: ['dist-js-app'] }, jsUnitTest: { From 5ac795572142e2fc523fea717824bb961d11569b Mon Sep 17 00:00:00 2001 From: Mario Volke Date: Wed, 3 Dec 2014 12:52:10 +0100 Subject: [PATCH 3/3] Fix missing icons in nav due to chrome bug with and angular directives --- src/tpl/nav.html | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/tpl/nav.html b/src/tpl/nav.html index f6d720a..15222af 100644 --- a/src/tpl/nav.html +++ b/src/tpl/nav.html @@ -8,13 +8,23 @@