Merge pull request #151 from whiteout-io/dev/WO-633

[WO-633] angular template minification
This commit is contained in:
Tankred Hase 2014-12-03 15:49:10 +01:00
commit fee1151952
3 changed files with 45 additions and 13 deletions

View File

@ -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: {
@ -447,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: {
@ -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',

View File

@ -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"
}
}
}

View File

@ -8,13 +8,23 @@
<li ng-repeat="folder in account.folders" ng-if="folder.wellknown" ng-hide="folder.type === 'Outbox' && folder.count < 1"
class="nav__folder" ng-class="{'nav__folder--open': state.nav.currentFolder === folder}">
<a href="#" wo-touch="$event.preventDefault(); openFolder(folder)">
<svg role="presentation">
<use ng-if="folder.type === 'Inbox'" xlink:href="#icon-inbox" />
<use ng-if="folder.type === 'Sent'" xlink:href="#icon-sent" />
<use ng-if="folder.type === 'Outbox'" xlink:href="#icon-outbox" />
<use ng-if="folder.type === 'Drafts'" xlink:href="#icon-draft" />
<use ng-if="folder.type === 'Trash'" xlink:href="#icon-delete" />
<use ng-if="folder.type === 'Flagged'" xlink:href="#icon-star" />
<svg ng-if="folder.type === 'Inbox'" role="presentation">
<use xlink:href="#icon-inbox" />
</svg>
<svg ng-if="folder.type === 'Sent'" role="presentation">
<use xlink:href="#icon-sent" />
</svg>
<svg ng-if="folder.type === 'Outbox'" role="presentation">
<use xlink:href="#icon-outbox" />
</svg>
<svg ng-if="folder.type === 'Drafts'" role="presentation">
<use xlink:href="#icon-draft" />
</svg>
<svg ng-if="folder.type === 'Trash'" role="presentation">
<use xlink:href="#icon-delete" />
</svg>
<svg ng-if="folder.type === 'Flagged'" role="presentation">
<use xlink:href="#icon-star" />
</svg>
{{folder.type}}
<span ng-show="folder.count > 0" class="nav__counter">{{folder.count}}</span>