Newer
Older

Rafael Ostertag
committed
var path = require('path');
var typo3_css = 'extension/Resources/Public/Css/';
var typo3_js = 'extension/Resources/Public/JavaScript/';
var typo3_fonts = 'extension/Resources/Public/fonts/';

Rafael Ostertag
committed
var js_sources = [
'javascript/src/Helper/*.js',
'javascript/src/Element/*.js',

Rafael Ostertag
committed
'javascript/src/*.js'
];
var js_worker = 'javascript/src/Worker/*.js';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
bootstrap: {
files: [
{
src: [
'bootstrap.min.css',
'bootstrap-theme.min.css'
],
dest: 'css/',
filter: 'isFile',
expand: true,
flatten: true
},
{
src: [
'bootstrap.min.js'
],
dest: 'js/',
expand: true,
flatten: true
},
{
expand: true,
src: [
'*'
],
dest: 'fonts/',
flatten: true
}
]
},

Rafael Ostertag
committed
},
src: [
'jquery.min.js'
],
expand: true,
dest: "js/",
flatten: true
}
]
},
Elias Villiger
committed
'jquery.tablesorter.combined.min.js',
'extras/jquery.tablesorter.pager.min.js',
'widgets/widget-columnSelector.min.js'
],
expand: true,
dest: typo3_js,
flatten: true

Rafael Ostertag
committed
},
Elias Villiger
committed
'jquery.tablesorter.combined.min.js',
'extras/jquery.tablesorter.pager.min.js',
'widgets/widget-columnSelector.min.js'
],
expand: true,
dest: 'js/',
flatten: true
}
]
},
src: [
'Chart.min.js'
],
expand: true,
dest: typo3_js,
flatten: true
},
{
src: [
'Chart.min.js'
],
expand: true,
dest: "js/",
flatten: true
}
]
},
cwd: 'node_modules/jqwidgets-framework/jqwidgets/',

Rafael Ostertag
committed
'jqx-all.js',
'globalization/globalize.js'
cwd: 'node_modules/jqwidgets-framework/jqwidgets/styles/',
'jqx.bootstrap.css'
cwd: 'node_modules/jqwidgets-framework/jqwidgets/styles/',
src: [
'images/**'
],
expand: true,
cwd: 'node_modules/jqwidgets-framework/jqwidgets/',

Rafael Ostertag
committed
'jqx-all.js',
'globalization/globalize.js'
],
expand: true,
dest: 'js/',
flatten: true
},
{
cwd: 'node_modules/jqwidgets-framework/jqwidgets/styles/',
'jqx.bootstrap.css'
],
expand: true,
dest: 'css/',
flatten: true
},
{
cwd: 'node_modules/jqwidgets-framework/jqwidgets/styles/',
src: [
'images/**'
],
expand: true,
dest: 'css/'
}
]

Rafael Ostertag
committed
},
],
expand: true,
dest: typo3_js,
flatten: true

Rafael Ostertag
committed
'themes/*/theme.min.js',
'plugins/*/plugin.min.js',
],
expand: true,
dest: 'js/',
flatten: true

Rafael Ostertag
committed
'themes/*/theme.min.js',
'plugins/*/plugin.min.js',

Rafael Ostertag
committed
eventEmitter: {
files: [
{

Rafael Ostertag
committed
src: [
'EventEmitter.min.js'
],
expand: true,
dest: typo3_js,
flatten: true
},
{

Rafael Ostertag
committed
src: [
'EventEmitter.min.js'
],
expand: true,
dest: 'js/',
flatten: true
}
]
},
fabric: {
files: [
{
cwd: 'javascript/',
src: [
'fabric.min.js'
],
expand: true,
dest: typo3_js,
flatten: true
},
{
cwd: 'javascript/',
src: [
'fabric.min.js'
],
expand: true,
dest: 'js/',
flatten: true
}
]
src: [
"typeahead.bundle.min.js"
],
expand: true,
dest: typo3_js,
flatten: true
},
{
src: [
"typeahead.bundle.min.js"
],
expand: true,
dest: 'js/',
flatten: true
}
]
src: [
"codemirror.js"
],
expand: true,
dest: typo3_js,
flatten: true
},
{
src: [
"codemirror.js"
],
expand: true,
dest: 'js/',
flatten: true
},
{
src: [
"codemirror.css"
],
expand: true,
dest: typo3_css,
flatten: true
},
{
src: [
"codemirror.css"
],
expand: true,
dest: 'css/',
flatten: true
},
{
src: [
"**"
],
expand: true,
dest: typo3_js + "/code-mirror-mode",
flatten: false
},
{
src: [
"**"
],
expand: true,
dest: "js/code-mirror-mode",
flatten: false
}
]
},
qfqPlugins: {
files: [
{
src: js_plugins,
expand: true,
dest: "js/",
flatten: true
},
{
src: js_plugins,
expand: true,
dest: typo3_js,
flatten: true
}
]
},
worker: {
files: [
{
src: js_worker,
expand: true,
dest: "js/Worker/",
flatten: true
},
{
src: js_worker,
expand: true,
dest: typo3_js,
},
{
src: js_worker,
expand: true,
dest: "mockup/Worker/",
flatten: true
},
fontAwesome: {
files: [
{
cwd: 'node_modules/font-awesome/css/',
src: [
'font-awesome.min.css'
],
dest: typo3_css,
filter: 'isFile',
expand: true,
flatten: true
},
{
cwd: 'node_modules/font-awesome/css/',
src: [
'font-awesome.min.css'
],
dest: 'css/',
filter: 'isFile',
expand: true,
flatten: true
},
{
cwd: 'node_modules/font-awesome/fonts/',
expand: true,
src: [
'*'
],
dest: typo3_fonts,
flatten: true
},
{
cwd: 'node_modules/font-awesome/fonts/',
expand: true,
src: [
'*'
],
dest: 'fonts/',
flatten: true
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
},
build: {
src: ['js/<%= pkg.name %>.debug.js'],
dest: typo3_js + '<%= pkg.name %>.min.js'
},
qfqFabric: {
src: ['javascript/src/Plugins/qfq.fabric.js'],
dest: typo3_js + 'qfq.fabric.min.js'
},
qfqValidator: {
src: ['javascript/src/Plugins/validator.js'],
dest: typo3_js + 'validator.min.js'

Rafael Ostertag
committed
concat_in_order: {

Rafael Ostertag
committed
debug_standalone: {

Rafael Ostertag
committed
options: {
extractRequired: function (filepath, filecontent) {
var workingdir = path.normalize(filepath).split(path.sep);
workingdir.pop();
var deps = this.getMatches(/\*\s*@depend\s(.*\.js)/g, filecontent);
deps.forEach(function (dep, i) {
var dependency = workingdir.concat([dep]);
deps[i] = path.join.apply(null, dependency);
});
return deps;
},
extractDeclared: function (filepath) {
return [filepath];
},
onlyConcatRequiredFiles: false
},
files: {
'js/<%= pkg.name %>.debug.js': js_sources
}

Rafael Ostertag
committed
},
debug_extension: {

Rafael Ostertag
committed
options: {
extractRequired: function (filepath, filecontent) {
var workingdir = path.normalize(filepath).split(path.sep);
workingdir.pop();
var deps = this.getMatches(/\*\s*@depend\s(.*\.js)/g, filecontent);
deps.forEach(function (dep, i) {
var dependency = workingdir.concat([dep]);
deps[i] = path.join.apply(null, dependency);
});
return deps;
},
extractDeclared: function (filepath) {
return [filepath];
},
onlyConcatRequiredFiles: false
},
files: {
'extension/Resources/Public/JavaScript/<%= pkg.name %>.debug.js': js_sources
}
"extension/Resources/Public/Css/qfq-bs.css": "less/qfq-bs.css.less",
"extension/Resources/Public/Css/qfq-letter.css": "less/qfq-letter.css.less",
"extension/Resources/Public/Css/qfq-plain.css": "less/qfq-plain.css.less",
Elias Villiger
committed
"extension/Resources/Public/Css/tablesorter-bootstrap.css": "less/tablesorter-bootstrap.less"
},
options: {
compress: true
}
},
devel: {
files: {
"css/qfq-bs.css": "less/qfq-bs.css.less",
"css/qfq-letter.css": "less/qfq-letter.css.less",
"css/qfq-plain.css": "less/qfq-plain.css.less",
Elias Villiger
committed
"css/tablesorter-bootstrap.css": "less/tablesorter-bootstrap.less"
banner: "/* Change qfq-bs.css.less, not qfq-bs.css */"

Rafael Ostertag
committed
unit: {
src: ['tests/jasmine/unit/spec/*Spec.js'],
options: {
vendor: [
'js/jquery.min.js',
'js/bootstrap.min.js',

Rafael Ostertag
committed
'js/EventEmitter.min.js',
'js/qfq.debug.js'
helpers: ['tests/jasmine/helper/mock-ajax.js'],

Rafael Ostertag
committed
template: 'tests/jasmine/unit/SpecRunner.tmpl'
files: js_sources.concat(['less/*.less']),
options: {
spawn: true
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');

Rafael Ostertag
committed
grunt.loadNpmTasks('grunt-concat-in-order');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jasmine');

Rafael Ostertag
committed
grunt.registerTask('default', ['jshint', 'concat_in_order', 'uglify', 'copy', 'less']);
grunt.registerTask('only-js', ['jshint', 'concat_in_order', 'uglify', 'copy:qfqPlugins', 'copy:worker']);

Rafael Ostertag
committed
grunt.registerTask('run-jasmine', ['jshint', 'concat_in_order', 'jasmine']);