Lidarr/Gruntfile.js

185 lines
6.0 KiB
JavaScript
Raw Normal View History

module.exports = function (grunt) {
2013-07-30 00:05:28 +00:00
'use strict';
var outputRoot = '_output/';
var outputDir = outputRoot +'UI/';
2013-11-24 08:58:05 +00:00
var srcRoot = 'src/UI/';
var srcContent = srcRoot + 'Content/';
2013-07-30 00:05:28 +00:00
var destContent = outputDir + 'Content/';
2013-03-22 23:39:08 +00:00
grunt.initConfig({
2013-07-30 00:05:28 +00:00
pkg: grunt.file.readJSON('package.json'),
clean: {
2013-07-30 00:05:28 +00:00
output: outputDir,
scripts: [ outputDir + '/**.js','!_output/UI/**/templates.js']
},
less : {
2013-06-26 05:42:44 +00:00
options:{
dumpLineNumbers : 'false',
2013-09-11 23:33:34 +00:00
compress : true,
2013-06-26 05:42:44 +00:00
yuicompress : false,
2013-09-11 23:33:34 +00:00
ieCompat : true,
strictImports : true
2013-06-26 05:42:44 +00:00
},
bootstrap: {
src : srcContent + 'bootstrap.less',
2013-07-30 00:05:28 +00:00
dest: destContent + 'bootstrap.css'
},
general : {
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 01:00:30 +00:00
],
dest : outputDir,
2013-08-02 01:00:30 +00:00
ext: '.css'
}
},
handlebars: {
options: {
2013-07-30 00:05:28 +00:00
namespace : 'T',
partialRegex: /Partial.html/,
wrapped : true,
amd : true,
processName: function (fileName) {
return fileName
.replace(srcRoot, '')
.replace('.html', '')
.toLowerCase();
}
},
files : {
src : [ srcRoot + '**/*Template.html', srcRoot + '**/*Partial.html'],
2013-07-30 00:05:28 +00:00
dest: outputDir + 'templates.js'
}
},
copy: {
2013-11-10 21:33:44 +00:00
content: {
cwd : srcRoot,
expand: true,
2013-11-10 21:33:44 +00:00
src : [
'index.html',
'**/*.css',
'**/*.png',
'**/*.jpg',
'**/*.ico',
'**/*.swf',
2013-11-10 21:33:44 +00:00
'**/FontAwesome/*.*',
'**/fonts/*.*'
],
dest : outputDir
},
scripts: {
cwd : srcRoot,
expand: true,
2013-11-10 21:33:44 +00:00
src : [
2013-11-24 08:58:05 +00:00
'**/*.js'
2013-11-10 21:33:44 +00:00
],
dest : outputDir
}
},
2013-03-29 01:49:14 +00:00
2013-11-11 04:09:11 +00: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 01:43:41 +00:00
requirejs: {
compile:{
options: {
mainConfigFile: 'src/UI/app.js',
2013-10-09 01:43:41 +00:00
fileExclusionRegExp: /^.*\.(?!js$)[^.]+$/,
2013-11-10 21:33:44 +00:00
preserveLicenseComments: false,
dir: outputDir,
2013-10-09 01:43:41 +00:00
optimize: 'none',
removeCombined: true,
inlineText: false,
2013-11-10 21:33:44 +00:00
keepBuildDir : true,
2013-10-09 01:43:41 +00:00
modules: [{
name: 'app',
2013-11-21 06:04:15 +00:00
exclude: ['templates.js']
2013-11-24 08:58:05 +00:00
}]
2013-10-09 01:43:41 +00:00
}
}
},
watch: {
options: {
2013-11-24 08:58:05 +00:00
nospawn: false
},
bootstrap : {
files: [ srcContent + 'Bootstrap/**', srcContent + 'FontAwesome/**', srcContent + 'bootstrap.less'],
tasks: ['less:bootstrap','less:general']
},
generalLess: {
files: [ srcRoot + '**/*.less', '!**/Bootstrap/**', '!**/FontAwesome/**', '!' + srcContent + '/bootstrap.less'],
tasks: ['less:general']
},
handlebars : {
files: '<%= handlebars.files.src %>',
tasks: ['handlebars']
},
2013-11-12 03:25:54 +00:00
content : {
files: [
2013-11-24 08:58:05 +00:00
srcRoot + '**/index.html',
srcRoot + '**/*.css',
srcRoot + '**/*.png',
srcRoot + '**/*.jpg',
srcRoot + '**/*.ico',
srcRoot + '**/FontAwesome/*.*',
srcRoot + '**/fonts/*.*'
2013-11-12 03:25:54 +00:00
],
2013-11-10 21:33:44 +00:00
tasks: ['copy:content']
},
2013-11-12 03:25:54 +00:00
scripts: {
files: '<%= copy.scripts.cwd %><%= copy.scripts.src %>',
tasks: ['copy:scripts']
}
}
});
2013-03-22 23:39:08 +00:00
grunt.loadNpmTasks('grunt-contrib-handlebars');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
2013-07-30 00:05:28 +00:00
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-notify');
2013-10-09 01:43:41 +00:00
grunt.loadNpmTasks('grunt-contrib-requirejs');
2013-11-11 04:09:11 +00:00
grunt.loadNpmTasks('grunt-contrib-jshint');
2013-07-30 00:05:28 +00:00
2013-11-11 04:10:10 +00:00
grunt.registerTask('package', ['clean:output', 'jshint', 'handlebars', 'copy', 'less']);
grunt.registerTask('packagerjs', ['clean:output','jshint', 'handlebars', 'requirejs', 'copy:content', 'less']);
grunt.registerTask('default', ['package', 'watch']);
2013-06-08 19:47:34 +00:00
};