added support for less file to grunt runner.

pull/4/head
kay.one 12 years ago
parent 27f45cfdee
commit 33aad6e8ef

@ -1,130 +1,144 @@
module.exports = function(grunt) { module.exports = function (grunt) {
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
curl: { curl: {
'UI/JsLibraries/backbone.collectionbinder.js': 'http://raw.github.com/theironcook/Backbone.ModelBinder/master/Backbone.CollectionBinder.js', 'UI/JsLibraries/backbone.collectionbinder.js': 'http://raw.github.com/theironcook/Backbone.ModelBinder/master/Backbone.CollectionBinder.js',
'UI/JsLibraries/backbone.js': 'http://backbonejs.org/backbone.js', 'UI/JsLibraries/backbone.js' : 'http://backbonejs.org/backbone.js',
'UI/JsLibraries/backbone.marionette.js': 'http://marionettejs.com/downloads/backbone.marionette.js', 'UI/JsLibraries/backbone.marionette.js' : 'http://marionettejs.com/downloads/backbone.marionette.js',
'UI/JsLibraries/backbone.modelbinder.js': 'http://raw.github.com/theironcook/Backbone.ModelBinder/master/Backbone.ModelBinder.js', 'UI/JsLibraries/backbone.modelbinder.js' : 'http://raw.github.com/theironcook/Backbone.ModelBinder/master/Backbone.ModelBinder.js',
'UI/JsLibraries/backbone.mutators.js': 'http://raw.github.com/asciidisco/Backbone.Mutators/master/backbone.mutators.js', 'UI/JsLibraries/backbone.mutators.js' : 'http://raw.github.com/asciidisco/Backbone.Mutators/master/backbone.mutators.js',
'UI/JsLibraries/backbone.shortcuts.js': 'http://raw.github.com/bry4n/backbone-shortcuts/master/backbone.shortcuts.js', 'UI/JsLibraries/backbone.shortcuts.js' : 'http://raw.github.com/bry4n/backbone-shortcuts/master/backbone.shortcuts.js',
//'UI/JsLibraries/bootstrap.js': //'UI/JsLibraries/bootstrap.js':
//'UI/JsLibraries/bootstrap.slider.js': //'UI/JsLibraries/bootstrap.slider.js':
'UI/JsLibraries/bootstrap.switch.js': 'http://raw.github.com/nostalgiaz/bootstrap-switch/master/static/js/bootstrapSwitch.js', 'UI/JsLibraries/bootstrap.switch.js' : 'http://raw.github.com/nostalgiaz/bootstrap-switch/master/static/js/bootstrapSwitch.js',
'UI/JsLibraries/handlebars.runtime.js': 'http://raw.github.com/wycats/handlebars.js/master/dist/handlebars.runtime.js', 'UI/JsLibraries/handlebars.runtime.js' : 'http://raw.github.com/wycats/handlebars.js/master/dist/handlebars.runtime.js',
'UI/JsLibraries/jquery.cookie.js': 'http://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js', 'UI/JsLibraries/jquery.cookie.js' : 'http://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js',
'UI/JsLibraries/jquery.js': 'http://code.jquery.com/jquery.js', 'UI/JsLibraries/jquery.js' : 'http://code.jquery.com/jquery.js',
//'NzbDrone.Backbone/JsLibraries/jquery.tablesorter.bootstrap.js': //'NzbDrone.Backbone/JsLibraries/jquery.tablesorter.bootstrap.js':
//'NzbDrone.Backbone/JsLibraries/jquery.tablesorter.js': //'NzbDrone.Backbone/JsLibraries/jquery.tablesorter.js':
'UI/JsLibraries/require.js': 'http://raw.github.com/jrburke/requirejs/master/require.js', 'UI/JsLibraries/require.js' : 'http://raw.github.com/jrburke/requirejs/master/require.js',
'UI/JsLibraries/sugar.js': 'http://raw.github.com/andrewplummer/Sugar/master/release/sugar-full.development.js', 'UI/JsLibraries/sugar.js' : 'http://raw.github.com/andrewplummer/Sugar/master/release/sugar-full.development.js',
'UI/JsLibraries/underscore.js': 'http://underscorejs.org/underscore.js' 'UI/JsLibraries/underscore.js' : 'http://underscorejs.org/underscore.js'
}, },
uglify: { uglify: {
files: { files: {
expand: true, // Enable dynamic expansion. expand: true, // Enable dynamic expansion.
cwd: 'UI/', // Src matches are relative to this path. cwd : 'UI/', // Src matches are relative to this path.
src: ['**/*.js'], // Actual pattern(s) to match. src : ['**/*.js'], // Actual pattern(s) to match.
dest: 'build/', // Destination path prefix. dest : 'build/', // Destination path prefix.
ext: '.min.js' ext : '.min.js'
} }
}, },
less:{ less : {
bootstrap:{ bootstrap: {
src: ["UI/Content/bootstrap/bootstrap.less"], src : "UI/Content/bootstrap/bootstrap.less",
dest: "_output/UI/Content/bootstrap.css" dest: "_output/UI/Content/bootstrap.css"
} },
}, general : {
files: [
{
expand: true,
src : ['UI/**/*.less', '!**/Bootstrap/**'],
dest : '_output/',
ext : '.css'
}
]
}
},
handlebars: { handlebars: {
options: { options: {
namespace: "Templates", namespace : "Templates",
wrapped: true, wrapped : true,
processName: function(fileName){ processName: function (fileName) {
return fileName return fileName
.replace('UI/','') .replace('UI/', '')
.replace('.html','') .replace('.html', '')
.toLowerCase(); .toLowerCase();
} }
}, },
files: { files : {
src: ['UI/**/*emplate.html'], src : ['UI/**/*emplate.html'],
dest: '_output/UI/templates.js' dest: '_output/UI/templates.js'
}, }
}, },
copy:{ copy: {
index:{ index : {
src: 'UI/index.html', src : 'UI/index.html',
dest: '_output/UI/index.html' dest: '_output/UI/index.html'
}, },
scripts:{ scripts: {
src: 'UI/**/*.js', src : 'UI/**/*.js',
dest: '_output/' dest: '_output/'
}, },
styles:{ styles : {
src: 'UI/**/*.css', src : 'UI/**/*.css',
dest: '_output/' dest: '_output/'
}, },
images:{ images : {
src: 'UI/**/*.png', src : 'UI/**/*.png',
dest: '_output/' dest: '_output/'
}, },
fonts:{ fonts : {
src: 'UI/**/Fonts/*.*', src : 'UI/**/Fonts/*.*',
dest: '_output/', dest: '_output/'
} }
}, },
watch:{ watch: {
bootstrap:{ bootstrap : {
files: 'NzbDrone.Backbone/Content/bootstrap/*.less', files: '<%= less.bootstrap.src %>',
tasks: ['less:bootstrap'] tasks: ['less:bootstrap']
}, },
handlebars:{ generalLess: {
files: '<%= handlebars.files.src %>', files: ['UI/**/*.less', '!**/Bootstrap/**'],
tasks: ['handlebars'] tasks: ['less:general']
}, },
copyIndex:{ handlebars : {
files: '<%= copy.index.src %>', files: '<%= handlebars.files.src %>',
tasks: ['copy:index'] tasks: ['handlebars']
}, },
copyScripts:{ copyIndex : {
files: '<%= copy.scripts.src %>', files: '<%= copy.index.src %>',
tasks: ['copy:scripts'] tasks: ['copy:index']
}, },
copyStyles:{ copyScripts: {
files: '<%= copy.styles.src %>', files: '<%= copy.scripts.src %>',
tasks: ['copy:styles'] tasks: ['copy:scripts']
}, },
copyImages:{ copyStyles : {
files: '<%= copy.images.src %>', files: '<%= copy.styles.src %>',
tasks: ['copy:images'] tasks: ['copy:styles']
}, },
copyFonts:{ copyImages : {
files: '<%= copy.fonts.src %>', files: '<%= copy.images.src %>',
tasks: ['copy:fonts'] tasks: ['copy:images']
} },
} copyFonts : {
}); files: '<%= copy.fonts.src %>',
tasks: ['copy:fonts']
}
}
});
// 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-less');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-wrap'); grunt.loadNpmTasks('grunt-wrap');
grunt.loadNpmTasks('grunt-notify'); grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-curl'); grunt.loadNpmTasks('grunt-curl');
// Default task(s). // Default task(s).
grunt.registerTask('default', ['copy','less:bootstrap','handlebars', 'watch']); grunt.registerTask('default', ['copy', 'less', 'handlebars', 'watch']);
grunt.registerTask('package', ['copy','less:bootstrap','handlebars']); grunt.registerTask('package', ['copy', 'less', 'handlebars']);
grunt.registerTask('update', ['curl']); grunt.registerTask('update', ['curl']);
}; };
Loading…
Cancel
Save