1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-10-05 23:57:20 +02:00

added precompiling of handlebar templates to grunt.

This commit is contained in:
kay.one 2013-03-23 16:24:27 -07:00
parent fb47bac883
commit 9ddfe34acc
2 changed files with 45 additions and 14 deletions

View File

@ -12,23 +12,51 @@ module.exports = function(grunt) {
ext: '.min.js' // Dest filepaths will have this extension. ext: '.min.js' // Dest filepaths will have this extension.
} }
}, },
less:{
bootstrap:{
files: {
"NzbDrone.Backbone/Content/bootstrap.css": "NzbDrone.Backbone/Content/Bootstrap/bootstrap.less"
}
}
},
handlebars: { handlebars: {
options: { options: {
namespace: "NzbDrone.Templates" namespace: "NzbDrone.Templates",
wrapped: false,
processName: function(fileName){
return fileName
.replace('NzbDrone.Backbone/','')
.replace('.html','');
}
}, },
files: { files: {
expand: true, // Enable dynamic expansion. src: ['NzbDrone.Backbone/**/*emplate.html'],
cwd: 'NzbDrone.Backbone/', // Src matches are relative to this path. dest: 'NzbDrone.Backbone/templates.js'
src: ['**/*Template.html'], },
ext: '.hbs' // Actual pattern(s) to match. },
watch:{
bootstrap:{
files: 'NzbDrone.Backbone/Content/Bootstrap/*.less',
tasks: ['less:bootstrap']
},
handlebars:{
files: '<%= handlebars.files.src %>',
tasks: ['handlebars']
} }
}});
}
});
// Load the plugin that provides the "uglify" task. // Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-handlebars'); grunt.loadNpmTasks('grunt-contrib-handlebars');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
// Default task(s). // Default task(s).
grunt.registerTask('default', ['uglify']); grunt.registerTask('default', ['watch']);
}; };

View File

@ -17,6 +17,9 @@
"dependencies": { "dependencies": {
"grunt": "*", "grunt": "*",
"grunt-contrib-uglify": "*", "grunt-contrib-uglify": "*",
"grunt-contrib-handlebars": "*" "grunt-contrib-handlebars": "*",
"grunt-contrib-watch": "~0.3.1",
"grunt-contrib-less": "~0.5.0",
"grunt-contrib-concat": "~0.1.3"
} }
} }