cleaned up gruntfile.js

pull/4/head
Keivan Beigi 11 years ago
parent 60177abf51
commit 0e199f3570

@ -1,7 +1,13 @@
module.exports = function (grunt) { 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({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
curl: { curl: {
@ -36,7 +42,8 @@ module.exports = function (grunt) {
}, },
clean: { clean: {
folder: "_output/UI/" output: outputDir,
scripts: [ outputDir + '/**.js','!_output/UI/**/templates.js']
}, },
less : { less : {
@ -49,8 +56,8 @@ module.exports = function (grunt) {
}, },
bootstrap: { bootstrap: {
src : "UI/Content/Bootstrap/bootstrap.less", src : srcContent + 'Bootstrap/bootstrap.less',
dest: "_output/UI/Content/bootstrap.css" dest: destContent + 'bootstrap.css'
}, },
general : { general : {
files: [ files: [
@ -66,7 +73,7 @@ module.exports = function (grunt) {
'UI/Logs/logs.less', 'UI/Logs/logs.less',
'UI/Settings/settings.less', 'UI/Settings/settings.less',
], ],
dest : '_output/', dest : outputRoot,
ext : '.css' ext : '.css'
} }
] ]
@ -75,7 +82,7 @@ module.exports = function (grunt) {
handlebars: { handlebars: {
options: { options: {
namespace : "T", namespace : 'T',
partialRegex: /Partial.html/, partialRegex: /Partial.html/,
wrapped : true, wrapped : true,
amd : true, amd : true,
@ -87,43 +94,43 @@ module.exports = function (grunt) {
} }
}, },
files : { files : {
src : ['UI/**/*emplate.html','UI/**/*Partial.html'], src : ['UI/**/*Template.html','UI/**/*Partial.html'],
dest: '_output/UI/templates.js' dest: outputDir + 'templates.js'
} }
}, },
copy: { copy: {
index : { index : {
src : 'UI/*ndex.html', src : 'UI/*ndex.html',
dest: '_output/' dest: outputRoot
}, },
scripts: { scripts: {
src : 'UI/**/*.js', src : 'UI/**/*.js',
dest: '_output/' dest: outputRoot
}, },
styles : { styles : {
src : 'UI/**/*.css', src : 'UI/**/*.css',
dest: '_output/' dest: outputRoot
}, },
images : { images : {
src : 'UI/**/*.png', src : 'UI/**/*.png',
dest: '_output/' dest: outputRoot
}, },
jpg : { jpg : {
src : 'UI/**/*.jpg', src : 'UI/**/*.jpg',
dest: '_output/' dest: outputRoot
}, },
icon : { icon : {
src : 'UI/**/*.ico', src : 'UI/**/*.ico',
dest: '_output/' dest: outputRoot
}, },
fontAwesome : { fontAwesome : {
src : 'UI/**/FontAwesome/*.*', src : 'UI/**/FontAwesome/*.*',
dest: '_output/' dest: outputRoot
}, },
fonts : { fonts : {
src : 'UI/**/fonts/*.*', src : 'UI/**/fonts/*.*',
dest: '_output/' dest: outputRoot
} }
}, },
@ -132,11 +139,11 @@ module.exports = function (grunt) {
nospawn: false, nospawn: false,
}, },
bootstrap : { bootstrap : {
files: ['UI/**/Bootstrap/**', 'UI/**/FontAwesome/**'], files: [ srcContent + 'Bootstrap/**', srcContent +'FontAwesome/**'],
tasks: ['less:bootstrap','less:general'] tasks: ['less:bootstrap','less:general']
}, },
generalLess: { generalLess: {
files: ['UI/**/*.less', '!**/Bootstrap/**', '!**/FontAwesome/**'], files: '<%= less.general.files[0].src %>',
tasks: ['less:general'] tasks: ['less:general']
}, },
handlebars : { handlebars : {
@ -163,7 +170,7 @@ module.exports = function (grunt) {
files: '<%= copy.jpg.src %>', files: '<%= copy.jpg.src %>',
tasks: ['copy:jpg'] tasks: ['copy:jpg']
}, },
copyJpg : { copyIcon : {
files: '<%= copy.icon.src %>', files: '<%= copy.icon.src %>',
tasks: ['copy:icon'] tasks: ['copy:icon']
}, },
@ -182,11 +189,11 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-notify'); grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-curl'); grunt.loadNpmTasks('grunt-curl');
grunt.loadNpmTasks('grunt-clean');
// Default task(s). grunt.registerTask('package', ['clean:output', 'copy', 'less', 'handlebars']);
grunt.registerTask('package', ['clean', 'copy', 'less', 'handlebars']);
grunt.registerTask('default', ['package', 'watch']); grunt.registerTask('default', ['package', 'watch']);
grunt.registerTask('update', ['curl']); grunt.registerTask('update', ['curl']);

@ -22,6 +22,6 @@
"grunt-contrib-copy": "*", "grunt-contrib-copy": "*",
"grunt-curl": "*", "grunt-curl": "*",
"grunt-notify": "*", "grunt-notify": "*",
"grunt-clean": "*" "grunt-contrib-clean": "*"
} }
} }

Loading…
Cancel
Save