From 0e199f35709286a07272d91548cd51f3b8418517 Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Mon, 29 Jul 2013 17:05:28 -0700 Subject: [PATCH] cleaned up gruntfile.js --- Gruntfile.js | 51 +++++++++++++++++++++++++++++---------------------- package.json | 2 +- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 445e1f73d..3a7be8c9e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,7 +1,13 @@ module.exports = function (grunt) { + 'use strict'; + + var outputRoot = '_output/'; + var outputDir = outputRoot +'UI/'; + var srcContent = 'UI/Content/'; + var destContent = outputDir + 'Content/'; - // Project configuration. grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), curl: { @@ -36,7 +42,8 @@ module.exports = function (grunt) { }, clean: { - folder: "_output/UI/" + output: outputDir, + scripts: [ outputDir + '/**.js','!_output/UI/**/templates.js'] }, less : { @@ -49,8 +56,8 @@ module.exports = function (grunt) { }, bootstrap: { - src : "UI/Content/Bootstrap/bootstrap.less", - dest: "_output/UI/Content/bootstrap.css" + src : srcContent + 'Bootstrap/bootstrap.less', + dest: destContent + 'bootstrap.css' }, general : { files: [ @@ -66,7 +73,7 @@ module.exports = function (grunt) { 'UI/Logs/logs.less', 'UI/Settings/settings.less', ], - dest : '_output/', + dest : outputRoot, ext : '.css' } ] @@ -75,7 +82,7 @@ module.exports = function (grunt) { handlebars: { options: { - namespace : "T", + namespace : 'T', partialRegex: /Partial.html/, wrapped : true, amd : true, @@ -87,43 +94,43 @@ module.exports = function (grunt) { } }, files : { - src : ['UI/**/*emplate.html','UI/**/*Partial.html'], - dest: '_output/UI/templates.js' + src : ['UI/**/*Template.html','UI/**/*Partial.html'], + dest: outputDir + 'templates.js' } }, copy: { index : { src : 'UI/*ndex.html', - dest: '_output/' + dest: outputRoot }, scripts: { src : 'UI/**/*.js', - dest: '_output/' + dest: outputRoot }, styles : { src : 'UI/**/*.css', - dest: '_output/' + dest: outputRoot }, images : { src : 'UI/**/*.png', - dest: '_output/' + dest: outputRoot }, jpg : { src : 'UI/**/*.jpg', - dest: '_output/' + dest: outputRoot }, icon : { src : 'UI/**/*.ico', - dest: '_output/' + dest: outputRoot }, fontAwesome : { src : 'UI/**/FontAwesome/*.*', - dest: '_output/' + dest: outputRoot }, fonts : { src : 'UI/**/fonts/*.*', - dest: '_output/' + dest: outputRoot } }, @@ -132,11 +139,11 @@ module.exports = function (grunt) { nospawn: false, }, bootstrap : { - files: ['UI/**/Bootstrap/**', 'UI/**/FontAwesome/**'], + files: [ srcContent + 'Bootstrap/**', srcContent +'FontAwesome/**'], tasks: ['less:bootstrap','less:general'] }, generalLess: { - files: ['UI/**/*.less', '!**/Bootstrap/**', '!**/FontAwesome/**'], + files: '<%= less.general.files[0].src %>', tasks: ['less:general'] }, handlebars : { @@ -163,7 +170,7 @@ module.exports = function (grunt) { files: '<%= copy.jpg.src %>', tasks: ['copy:jpg'] }, - copyJpg : { + copyIcon : { files: '<%= copy.icon.src %>', tasks: ['copy:icon'] }, @@ -182,11 +189,11 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-notify'); grunt.loadNpmTasks('grunt-curl'); - grunt.loadNpmTasks('grunt-clean'); - // Default task(s). - grunt.registerTask('package', ['clean', 'copy', 'less', 'handlebars']); + + grunt.registerTask('package', ['clean:output', 'copy', 'less', 'handlebars']); grunt.registerTask('default', ['package', 'watch']); grunt.registerTask('update', ['curl']); diff --git a/package.json b/package.json index da6d3b3a5..4ce59dc39 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,6 @@ "grunt-contrib-copy": "*", "grunt-curl": "*", "grunt-notify": "*", - "grunt-clean": "*" + "grunt-contrib-clean": "*" } }