Minify templates and concat into one file.

This commit is contained in:
Your Name 2014-06-06 13:06:31 +02:00
parent 3fa715298e
commit 5c568e649f
5 changed files with 33 additions and 2 deletions

View file

@ -182,6 +182,26 @@ module.exports = function (grunt) {
} }
}, },
html2js: {
options: {
base: 'app',
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
},
main: {
src: ['<%= yeoman.app %>/views/{*,**/*}.html'],
dest: '.tmp/scripts/templates.js'
}
},
// Renames files for browser caching purposes // Renames files for browser caching purposes
rev: { rev: {
dist: { dist: {
@ -396,6 +416,7 @@ module.exports = function (grunt) {
grunt.registerTask('build', [ grunt.registerTask('build', [
'clean:dist', 'clean:dist',
'bowerInstall', 'bowerInstall',
'html2js',
'useminPrepare', 'useminPrepare',
'concurrent:dist', 'concurrent:dist',
'autoprefixer', 'autoprefixer',

View file

@ -34,7 +34,11 @@
<script src="bower_components/underscore/underscore.js"></script> <script src="bower_components/underscore/underscore.js"></script>
<!-- endbuild --> <!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/scripts.js --> <!-- build:js(.tmp) scripts/templates.js -->
<script src="scripts/templates.js"></script>
<!-- endbuild -->
<!-- build:js scripts/scripts.js -->
<script src="scripts/app.js"></script> <script src="scripts/app.js"></script>
<script src="scripts/libs.js"></script> <script src="scripts/libs.js"></script>
<script src="scripts/config.js"></script> <script src="scripts/config.js"></script>

View file

@ -4,7 +4,8 @@ angular.module('ffffng', [
'ngSanitize', 'ngSanitize',
'ngRoute', 'ngRoute',
'ng', 'ng',
'leaflet-directive' 'leaflet-directive',
'templates-main'
]) ])
.config(function ($routeProvider) { .config(function ($routeProvider) {
$routeProvider $routeProvider

4
app/scripts/templates.js Normal file
View file

@ -0,0 +1,4 @@
/**
* Placeholder module for development. The real module holding the templates is generated via the html2js task.
*/
angular.module('templates-main', []);

View file

@ -23,6 +23,7 @@
"grunt-contrib-uglify": "~0.2.0", "grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "~0.5.2", "grunt-contrib-watch": "~0.5.2",
"grunt-develop": "~0.4.0", "grunt-develop": "~0.4.0",
"grunt-html2js": "~0.2.7",
"grunt-newer": "~0.6.1", "grunt-newer": "~0.6.1",
"grunt-ngmin": "~0.0.2", "grunt-ngmin": "~0.0.2",
"grunt-rev": "~0.1.0", "grunt-rev": "~0.1.0",