2013-04-21 02:48:29 +03:00
|
|
|
module.exports = function (grunt) {
|
2013-07-30 03:05:28 +03:00
|
|
|
'use strict';
|
|
|
|
|
2013-10-03 04:01:32 +03:00
|
|
|
var outputRoot = '_output/';
|
|
|
|
var outputDir = outputRoot +'UI/';
|
|
|
|
var srcRoot = 'src/UI/'
|
|
|
|
var srcContent = srcRoot + 'Content/';
|
2013-07-30 03:05:28 +03:00
|
|
|
var destContent = outputDir + 'Content/';
|
2013-03-23 02:39:08 +03:00
|
|
|
|
2013-04-21 02:48:29 +03:00
|
|
|
grunt.initConfig({
|
2013-07-30 03:05:28 +03:00
|
|
|
|
2013-04-21 02:48:29 +03:00
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2013-04-18 21:01:21 +03:00
|
|
|
|
2013-04-21 02:48:29 +03:00
|
|
|
curl: {
|
2013-10-03 04:01:32 +03:00
|
|
|
'src/UI/JsLibraries/backbone.js' : 'http://documentcloud.github.io/backbone/backbone.js',
|
|
|
|
'src/UI/JsLibraries/backbone.marionette.js' : 'http://marionettejs.com/downloads/backbone.marionette.js',
|
|
|
|
'src/UI/JsLibraries/backbone.modelbinder.js' : 'http://raw.github.com/theironcook/Backbone.ModelBinder/master/Backbone.ModelBinder.js',
|
|
|
|
'src/UI/JsLibraries/backbone.shortcuts.js' : 'http://raw.github.com/bry4n/backbone-shortcuts/master/backbone.shortcuts.js',
|
2013-06-08 22:47:34 +03:00
|
|
|
|
2013-10-03 04:01:32 +03:00
|
|
|
'src/UI/JsLibraries/backbone.pageable.js' : 'http://raw.github.com/wyuenho/backbone-pageable/master/lib/backbone-pageable.js',
|
|
|
|
'src/UI/JsLibraries/backbone.backgrid.js' : 'http://raw.github.com/wyuenho/backgrid/master/lib/backgrid.js',
|
|
|
|
'src/UI/JsLibraries/backbone.backgrid.paginator.js' : 'http://raw.github.com/wyuenho/backgrid/master/lib/extensions/paginator/backgrid-paginator.js',
|
|
|
|
'src/UI/JsLibraries/backbone.backgrid.filter.js' : 'http://raw.github.com/wyuenho/backgrid/master/lib/extensions/filter/backgrid-filter.js',
|
2013-05-15 08:49:31 +03:00
|
|
|
|
2013-10-08 05:37:02 +03:00
|
|
|
'src/UI/JsLibraries/backbone.backgrid.selectall.js' : 'http://raw.github.com/wyuenho/backgrid-select-all/master/backgrid-select-all.js',
|
|
|
|
'src/UI/Content/Backgrid/selectall.css' : 'http://raw.github.com/wyuenho/backgrid-select-all/master/backgrid-select-all.css',
|
2013-10-05 06:47:20 +03:00
|
|
|
|
2013-10-03 04:01:32 +03:00
|
|
|
'src/UI/JsLibraries/backbone.validation.js' : 'https://raw.github.com/thedersen/backbone.validation/master/dist/backbone-validation.js',
|
2013-08-21 04:07:48 +03:00
|
|
|
|
2013-10-03 04:01:32 +03:00
|
|
|
'src/UI/JsLibraries/handlebars.runtime.js' : 'http://raw.github.com/wycats/handlebars.js/master/dist/handlebars.runtime.js',
|
|
|
|
'src/UI/JsLibraries/handlebars.helpers.js' : 'http://raw.github.com/danharper/Handlebars-Helpers/master/helpers.js',
|
2013-05-15 08:49:31 +03:00
|
|
|
|
2013-10-03 04:01:32 +03:00
|
|
|
'src/UI/JsLibraries/jquery.js' : 'http://code.jquery.com/jquery.js',
|
|
|
|
'src/UI/JsLibraries/jquery.backstretch.js' : 'http://raw.github.com/srobbin/jquery-backstretch/master/jquery.backstretch.js',
|
|
|
|
'src/UI/JsLibraries/jquery.signalR.js' : 'http://raw.github.com/SignalR/SignalR/master/samples/Microsoft.AspNet.SignalR.Hosting.AspNet.Samples/Scripts/jquery.signalR.js',
|
|
|
|
'src/UI/JsLibraries/jquery.knob.js' : 'http://raw.github.com/aterrien/jQuery-Knob/master/js/jquery.knob.js',
|
2013-05-15 08:49:31 +03:00
|
|
|
|
2013-10-03 04:01:32 +03:00
|
|
|
'src/UI/JsLibraries/require.js' : 'http://raw.github.com/jrburke/requirejs/master/require.js',
|
|
|
|
'src/UI/JsLibraries/filesize.js' : 'http://cdn.filesizejs.com/filesize.js',
|
|
|
|
'src/UI/JsLibraries/lodash.underscore.js' : 'http://raw.github.com/bestiejs/lodash/master/dist/lodash.underscore.js',
|
2013-05-15 08:49:31 +03:00
|
|
|
|
2013-10-03 04:01:32 +03:00
|
|
|
'src/UI/JsLibraries/messenger.js' : 'http://raw.github.com/HubSpot/messenger/master/build/js/messenger.js',
|
|
|
|
'src/UI/Content/Messenger/messenger.css' : 'http://raw.github.com/HubSpot/messenger/master/build/css/messenger.css',
|
|
|
|
'src/UI/Content/Messenger/messenger.future.css' : 'http://raw.github.com/HubSpot/messenger/master/build/css/messenger-theme-future.css',
|
2013-05-15 08:49:31 +03:00
|
|
|
|
2013-10-03 04:01:32 +03:00
|
|
|
'src/UI/Content/bootstrap.toggle-switch.css' : 'http://raw.github.com/ghinda/css-toggle-switch/gh-pages/toggle-switch.css',
|
|
|
|
'src/UI/Content/prefixer.less' : 'http://raw.github.com/JoelSutherland/LESS-Prefixer/master/prefixer.less'
|
2013-04-21 02:48:29 +03:00
|
|
|
},
|
2013-04-18 21:01:21 +03:00
|
|
|
|
2013-05-01 10:01:17 +03:00
|
|
|
clean: {
|
2013-07-30 03:05:28 +03:00
|
|
|
output: outputDir,
|
|
|
|
scripts: [ outputDir + '/**.js','!_output/UI/**/templates.js']
|
2013-04-21 02:48:29 +03:00
|
|
|
},
|
2013-05-01 10:01:17 +03:00
|
|
|
|
2013-04-21 02:48:29 +03:00
|
|
|
less : {
|
2013-06-26 08:42:44 +03:00
|
|
|
|
|
|
|
options:{
|
|
|
|
dumpLineNumbers : 'false',
|
2013-09-12 02:33:34 +03:00
|
|
|
compress : true,
|
2013-06-26 08:42:44 +03:00
|
|
|
yuicompress : false,
|
2013-09-12 02:33:34 +03:00
|
|
|
ieCompat : true,
|
|
|
|
strictImports : true
|
2013-06-26 08:42:44 +03:00
|
|
|
},
|
|
|
|
|
2013-04-21 02:48:29 +03:00
|
|
|
bootstrap: {
|
2013-07-30 03:05:28 +03:00
|
|
|
src : srcContent + 'Bootstrap/bootstrap.less',
|
|
|
|
dest: destContent + 'bootstrap.css'
|
2013-04-21 02:48:29 +03:00
|
|
|
},
|
|
|
|
general : {
|
2013-10-03 04:01:32 +03: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 04:00:30 +03:00
|
|
|
],
|
2013-10-03 04:01:32 +03:00
|
|
|
dest : outputDir,
|
2013-08-02 04:00:30 +03:00
|
|
|
ext: '.css'
|
2013-04-21 02:48:29 +03:00
|
|
|
}
|
|
|
|
},
|
2013-03-24 02:24:27 +03:00
|
|
|
|
2013-04-21 02:48:29 +03:00
|
|
|
handlebars: {
|
|
|
|
options: {
|
2013-07-30 03:05:28 +03:00
|
|
|
namespace : 'T',
|
2013-06-08 22:39:53 +03:00
|
|
|
partialRegex: /Partial.html/,
|
2013-06-15 02:36:59 +03:00
|
|
|
wrapped : true,
|
|
|
|
amd : true,
|
2013-04-21 02:48:29 +03:00
|
|
|
processName: function (fileName) {
|
|
|
|
return fileName
|
2013-10-03 04:01:32 +03:00
|
|
|
.replace(srcRoot, '')
|
2013-04-21 02:48:29 +03:00
|
|
|
.replace('.html', '')
|
|
|
|
.toLowerCase();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
files : {
|
2013-10-03 04:01:32 +03:00
|
|
|
src : [ srcRoot + '**/*Template.html', srcRoot + '**/*Partial.html'],
|
2013-07-30 03:05:28 +03:00
|
|
|
dest: outputDir + 'templates.js'
|
2013-04-21 02:48:29 +03:00
|
|
|
}
|
|
|
|
},
|
2013-03-24 02:24:27 +03:00
|
|
|
|
2013-04-21 02:48:29 +03:00
|
|
|
copy: {
|
2013-11-11 00:33:44 +03:00
|
|
|
content: {
|
2013-10-03 04:01:32 +03:00
|
|
|
cwd : srcRoot,
|
|
|
|
expand: true,
|
2013-11-11 00:33:44 +03:00
|
|
|
src : [
|
|
|
|
'index.html',
|
|
|
|
'**/*.css',
|
|
|
|
'**/*.png',
|
|
|
|
'**/*.jpg',
|
|
|
|
'**/*.ico',
|
|
|
|
'**/FontAwesome/*.*',
|
|
|
|
'**/fonts/*.*'
|
|
|
|
],
|
2013-10-03 04:01:32 +03:00
|
|
|
dest : outputDir
|
2013-04-21 02:48:29 +03:00
|
|
|
},
|
|
|
|
scripts: {
|
2013-10-03 04:01:32 +03:00
|
|
|
cwd : srcRoot,
|
|
|
|
expand: true,
|
2013-11-11 00:33:44 +03:00
|
|
|
src : [
|
|
|
|
'**/*.js',
|
|
|
|
],
|
2013-10-03 04:01:32 +03:00
|
|
|
dest : outputDir
|
2013-04-21 02:48:29 +03:00
|
|
|
}
|
|
|
|
},
|
2013-03-29 04:49:14 +03:00
|
|
|
|
2013-11-11 07:09:11 +03: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 04:43:41 +03:00
|
|
|
requirejs: {
|
|
|
|
compile:{
|
|
|
|
options: {
|
2013-11-11 00:33:44 +03:00
|
|
|
mainConfigFile: "src/UI/app.js",
|
2013-10-09 04:43:41 +03:00
|
|
|
fileExclusionRegExp: /^.*\.(?!js$)[^.]+$/,
|
2013-11-11 00:33:44 +03:00
|
|
|
preserveLicenseComments: false,
|
|
|
|
dir: outputDir,
|
2013-10-09 04:43:41 +03:00
|
|
|
optimize: 'none',
|
|
|
|
removeCombined: true,
|
|
|
|
inlineText: false,
|
2013-11-11 00:33:44 +03:00
|
|
|
keepBuildDir : true,
|
2013-10-09 04:43:41 +03:00
|
|
|
modules: [{
|
|
|
|
name: 'app',
|
2013-11-11 00:33:44 +03:00
|
|
|
exclude: ['JsLibraries/jquery', 'templates.js']
|
2013-10-09 04:43:41 +03:00
|
|
|
}],
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-04-21 02:48:29 +03:00
|
|
|
watch: {
|
2013-06-25 02:41:59 +03:00
|
|
|
options: {
|
|
|
|
nospawn: false,
|
|
|
|
},
|
2013-04-21 02:48:29 +03:00
|
|
|
bootstrap : {
|
2013-07-30 03:05:28 +03:00
|
|
|
files: [ srcContent + 'Bootstrap/**', srcContent +'FontAwesome/**'],
|
2013-06-26 03:34:50 +03:00
|
|
|
tasks: ['less:bootstrap','less:general']
|
2013-04-21 02:48:29 +03:00
|
|
|
},
|
|
|
|
generalLess: {
|
2013-10-03 04:01:32 +03:00
|
|
|
files: [ srcRoot + '**/*.less', '!**/Bootstrap/**', '!**/FontAwesome/**'],
|
2013-04-21 02:48:29 +03:00
|
|
|
tasks: ['less:general']
|
|
|
|
},
|
|
|
|
handlebars : {
|
|
|
|
files: '<%= handlebars.files.src %>',
|
|
|
|
tasks: ['handlebars']
|
|
|
|
},
|
2013-11-11 00:33:44 +03:00
|
|
|
copyContent : {
|
|
|
|
files: '<%= copy.content.cwd %><%= copy.content.src %>',
|
|
|
|
tasks: ['copy:content']
|
2013-04-21 02:48:29 +03:00
|
|
|
},
|
|
|
|
copyScripts: {
|
2013-10-04 09:01:02 +03:00
|
|
|
files: '<%= copy.scripts.cwd %><%= copy.scripts.src %>',
|
2013-04-21 02:48:29 +03:00
|
|
|
tasks: ['copy:scripts']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2013-03-23 02:39:08 +03:00
|
|
|
|
2013-04-21 02:48:29 +03:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-handlebars');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
2013-07-30 03:05:28 +03:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
2013-04-21 02:48:29 +03:00
|
|
|
grunt.loadNpmTasks('grunt-notify');
|
|
|
|
grunt.loadNpmTasks('grunt-curl');
|
2013-10-09 04:43:41 +03:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
2013-11-11 07:09:11 +03:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
2013-07-30 03:05:28 +03:00
|
|
|
|
2013-11-11 07:10:10 +03:00
|
|
|
grunt.registerTask('package', ['clean:output', 'jshint', 'handlebars', 'copy', 'less']);
|
|
|
|
grunt.registerTask('packagerjs', ['clean:output','jshint', 'handlebars', 'requirejs', 'copy:content', 'less']);
|
2013-05-01 10:01:17 +03:00
|
|
|
grunt.registerTask('default', ['package', 'watch']);
|
2013-04-21 02:48:29 +03:00
|
|
|
grunt.registerTask('update', ['curl']);
|
2013-03-23 02:39:08 +03:00
|
|
|
|
2013-06-08 22:47:34 +03:00
|
|
|
};
|