2013-04-21 01:48:29 +02:00
|
|
|
module.exports = function (grunt) {
|
2013-07-30 02:05:28 +02:00
|
|
|
'use strict';
|
|
|
|
|
2013-10-03 03:01:32 +02:00
|
|
|
var outputRoot = '_output/';
|
|
|
|
var outputDir = outputRoot +'UI/';
|
2013-11-24 09:58:05 +01:00
|
|
|
var srcRoot = 'src/UI/';
|
2013-10-03 03:01:32 +02:00
|
|
|
var srcContent = srcRoot + 'Content/';
|
2013-07-30 02:05:28 +02:00
|
|
|
var destContent = outputDir + 'Content/';
|
2013-03-23 00:39:08 +01:00
|
|
|
|
2013-04-21 01:48:29 +02:00
|
|
|
grunt.initConfig({
|
2013-07-30 02:05:28 +02:00
|
|
|
|
2013-04-21 01:48:29 +02:00
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2013-04-18 20:01:21 +02:00
|
|
|
|
2013-05-01 09:01:17 +02:00
|
|
|
clean: {
|
2013-07-30 02:05:28 +02:00
|
|
|
output: outputDir,
|
|
|
|
scripts: [ outputDir + '/**.js','!_output/UI/**/templates.js']
|
2013-04-21 01:48:29 +02:00
|
|
|
},
|
2013-05-01 09:01:17 +02:00
|
|
|
|
2013-04-21 01:48:29 +02:00
|
|
|
less : {
|
2013-06-26 07:42:44 +02:00
|
|
|
|
|
|
|
options:{
|
|
|
|
dumpLineNumbers : 'false',
|
2013-09-12 01:33:34 +02:00
|
|
|
compress : true,
|
2013-06-26 07:42:44 +02:00
|
|
|
yuicompress : false,
|
2013-09-12 01:33:34 +02:00
|
|
|
ieCompat : true,
|
|
|
|
strictImports : true
|
2013-06-26 07:42:44 +02:00
|
|
|
},
|
|
|
|
|
2013-04-21 01:48:29 +02:00
|
|
|
bootstrap: {
|
2014-05-04 09:11:43 +02:00
|
|
|
src : srcContent + 'bootstrap.less',
|
2013-07-30 02:05:28 +02:00
|
|
|
dest: destContent + 'bootstrap.css'
|
2013-04-21 01:48:29 +02:00
|
|
|
},
|
|
|
|
general : {
|
2013-10-03 03:01:32 +02:00
|
|
|
cwd : srcRoot,
|
|
|
|
expand : true,
|
|
|
|
src :[
|
|
|
|
'Content/theme.less',
|
|
|
|
'Content/overrides.less',
|
|
|
|
'Series/series.less',
|
|
|
|
'AddSeries/addSeries.less',
|
|
|
|
'Calendar/calendar.less',
|
|
|
|
'Cells/cells.less',
|
|
|
|
'Settings/settings.less',
|
|
|
|
'System/Logs/logs.less',
|
|
|
|
'System/Update/update.less'
|
2013-08-02 03:00:30 +02:00
|
|
|
],
|
2013-10-03 03:01:32 +02:00
|
|
|
dest : outputDir,
|
2013-08-02 03:00:30 +02:00
|
|
|
ext: '.css'
|
2013-04-21 01:48:29 +02:00
|
|
|
}
|
|
|
|
},
|
2013-03-24 00:24:27 +01:00
|
|
|
|
2013-04-21 01:48:29 +02:00
|
|
|
handlebars: {
|
|
|
|
options: {
|
2013-07-30 02:05:28 +02:00
|
|
|
namespace : 'T',
|
2013-06-08 21:39:53 +02:00
|
|
|
partialRegex: /Partial.html/,
|
2013-06-15 01:36:59 +02:00
|
|
|
wrapped : true,
|
|
|
|
amd : true,
|
2013-04-21 01:48:29 +02:00
|
|
|
processName: function (fileName) {
|
|
|
|
return fileName
|
2013-10-03 03:01:32 +02:00
|
|
|
.replace(srcRoot, '')
|
2013-04-21 01:48:29 +02:00
|
|
|
.replace('.html', '')
|
|
|
|
.toLowerCase();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
files : {
|
2013-10-03 03:01:32 +02:00
|
|
|
src : [ srcRoot + '**/*Template.html', srcRoot + '**/*Partial.html'],
|
2013-07-30 02:05:28 +02:00
|
|
|
dest: outputDir + 'templates.js'
|
2013-04-21 01:48:29 +02:00
|
|
|
}
|
|
|
|
},
|
2013-03-24 00:24:27 +01:00
|
|
|
|
2013-04-21 01:48:29 +02:00
|
|
|
copy: {
|
2013-11-10 22:33:44 +01:00
|
|
|
content: {
|
2013-10-03 03:01:32 +02:00
|
|
|
cwd : srcRoot,
|
|
|
|
expand: true,
|
2013-11-10 22:33:44 +01:00
|
|
|
src : [
|
|
|
|
'index.html',
|
|
|
|
'**/*.css',
|
|
|
|
'**/*.png',
|
|
|
|
'**/*.jpg',
|
|
|
|
'**/*.ico',
|
2014-03-14 05:23:47 +01:00
|
|
|
'**/*.swf',
|
2013-11-10 22:33:44 +01:00
|
|
|
'**/FontAwesome/*.*',
|
|
|
|
'**/fonts/*.*'
|
|
|
|
],
|
2013-10-03 03:01:32 +02:00
|
|
|
dest : outputDir
|
2013-04-21 01:48:29 +02:00
|
|
|
},
|
|
|
|
scripts: {
|
2013-10-03 03:01:32 +02:00
|
|
|
cwd : srcRoot,
|
|
|
|
expand: true,
|
2013-11-10 22:33:44 +01:00
|
|
|
src : [
|
2013-11-24 09:58:05 +01:00
|
|
|
'**/*.js'
|
2013-11-10 22:33:44 +01:00
|
|
|
],
|
2013-10-03 03:01:32 +02:00
|
|
|
dest : outputDir
|
2013-04-21 01:48:29 +02:00
|
|
|
}
|
|
|
|
},
|
2013-03-29 02:49:14 +01:00
|
|
|
|
2013-11-11 05:09:11 +01:00
|
|
|
jshint: {
|
|
|
|
options: {
|
|
|
|
'-W030': false,
|
|
|
|
'-W064': false,
|
|
|
|
'-W097': false,
|
|
|
|
'-W100': false,
|
|
|
|
'undef': true,
|
|
|
|
'globals': {
|
|
|
|
'require': true,
|
|
|
|
'define': true,
|
|
|
|
'window': true,
|
|
|
|
'document': true,
|
|
|
|
'console': true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
all: [
|
|
|
|
srcRoot + '**/*.js',
|
|
|
|
'!**/JsLibraries/*.js'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2013-10-09 03:43:41 +02:00
|
|
|
requirejs: {
|
|
|
|
compile:{
|
|
|
|
options: {
|
2014-05-04 09:11:43 +02:00
|
|
|
mainConfigFile: 'src/UI/app.js',
|
2013-10-09 03:43:41 +02:00
|
|
|
fileExclusionRegExp: /^.*\.(?!js$)[^.]+$/,
|
2013-11-10 22:33:44 +01:00
|
|
|
preserveLicenseComments: false,
|
|
|
|
dir: outputDir,
|
2013-10-09 03:43:41 +02:00
|
|
|
optimize: 'none',
|
|
|
|
removeCombined: true,
|
|
|
|
inlineText: false,
|
2013-11-10 22:33:44 +01:00
|
|
|
keepBuildDir : true,
|
2013-10-09 03:43:41 +02:00
|
|
|
modules: [{
|
|
|
|
name: 'app',
|
2013-11-21 07:04:15 +01:00
|
|
|
exclude: ['templates.js']
|
2013-11-24 09:58:05 +01:00
|
|
|
}]
|
2013-10-09 03:43:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-04-21 01:48:29 +02:00
|
|
|
watch: {
|
2013-06-25 01:41:59 +02:00
|
|
|
options: {
|
2013-11-24 09:58:05 +01:00
|
|
|
nospawn: false
|
2013-06-25 01:41:59 +02:00
|
|
|
},
|
2013-04-21 01:48:29 +02:00
|
|
|
bootstrap : {
|
2014-05-04 09:11:43 +02:00
|
|
|
files: [ srcContent + 'Bootstrap/**', srcContent + 'FontAwesome/**', srcContent + 'bootstrap.less'],
|
2013-06-26 02:34:50 +02:00
|
|
|
tasks: ['less:bootstrap','less:general']
|
2013-04-21 01:48:29 +02:00
|
|
|
},
|
|
|
|
generalLess: {
|
2014-05-04 09:11:43 +02:00
|
|
|
files: [ srcRoot + '**/*.less', '!**/Bootstrap/**', '!**/FontAwesome/**', '!' + srcContent + '/bootstrap.less'],
|
2013-04-21 01:48:29 +02:00
|
|
|
tasks: ['less:general']
|
|
|
|
},
|
|
|
|
handlebars : {
|
|
|
|
files: '<%= handlebars.files.src %>',
|
|
|
|
tasks: ['handlebars']
|
|
|
|
},
|
2013-11-12 04:25:54 +01:00
|
|
|
content : {
|
|
|
|
files: [
|
2013-11-24 09:58:05 +01:00
|
|
|
srcRoot + '**/index.html',
|
|
|
|
srcRoot + '**/*.css',
|
|
|
|
srcRoot + '**/*.png',
|
|
|
|
srcRoot + '**/*.jpg',
|
|
|
|
srcRoot + '**/*.ico',
|
|
|
|
srcRoot + '**/FontAwesome/*.*',
|
|
|
|
srcRoot + '**/fonts/*.*'
|
2013-11-12 04:25:54 +01:00
|
|
|
],
|
2013-11-10 22:33:44 +01:00
|
|
|
tasks: ['copy:content']
|
2013-04-21 01:48:29 +02:00
|
|
|
},
|
2013-11-12 04:25:54 +01:00
|
|
|
scripts: {
|
2013-10-04 08:01:02 +02:00
|
|
|
files: '<%= copy.scripts.cwd %><%= copy.scripts.src %>',
|
2013-04-21 01:48:29 +02:00
|
|
|
tasks: ['copy:scripts']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2013-03-23 00:39:08 +01:00
|
|
|
|
2013-04-21 01:48:29 +02:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-handlebars');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
2013-07-30 02:05:28 +02:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
2013-04-21 01:48:29 +02:00
|
|
|
grunt.loadNpmTasks('grunt-notify');
|
2013-10-09 03:43:41 +02:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
2013-11-11 05:09:11 +01:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
2013-07-30 02:05:28 +02:00
|
|
|
|
2013-11-11 05:10:10 +01:00
|
|
|
grunt.registerTask('package', ['clean:output', 'jshint', 'handlebars', 'copy', 'less']);
|
|
|
|
grunt.registerTask('packagerjs', ['clean:output','jshint', 'handlebars', 'requirejs', 'copy:content', 'less']);
|
2013-05-01 09:01:17 +02:00
|
|
|
grunt.registerTask('default', ['package', 'watch']);
|
2013-06-08 21:47:34 +02:00
|
|
|
};
|