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'
];
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
bootstrap: {
files: [
{
bootstrap_dev: {
files: [
{
cwd: 'bower_components/bootstrap/dist/css/',
src: [
'bootstrap.min.css',
'bootstrap-theme.min.css'
],
dest: 'css/',
filter: 'isFile',
expand: true,
flatten: true
},
{
cwd: 'bower_components/bootstrap/dist/js/',
src: [
'bootstrap.min.js'
],
dest: 'js/',
expand: true,
flatten: true
},
{
cwd: 'bower_components/bootstrap/dist/fonts/',
expand: true,
src: [
'*'
],
dest: 'fonts/',
flatten: true
}
]
},

Rafael Ostertag
committed
bootstrap_validator: {
files: [
{
cwd: 'bower_components/bootstrap-validator/dist/',
src: [
'validator.min.js'
],
dest: 'js/',
expand: true,
flatten: true
},
{
cwd: 'bower_components/bootstrap-validator/dist/',
src: [
'validator.min.js'
],
dest: typo3_js,
expand: true,
flatten: true
}
]
},

Rafael Ostertag
committed
},
{
cwd: 'bower_components/jquery/dist/',
src: [
'jquery.min.js'
],
expand: true,
dest: "js/",
flatten: true
}
]
},
jquery_tablesorter: {
files: [
{
cwd: 'bower_components/tablesorter/dist/js/',
src: [
'jquery.tablesorter.min.js'
],
expand: true,
dest: typo3_js,
flatten: true

Rafael Ostertag
committed
},
{
cwd: 'bower_components/tablesorter/dist/js/',
src: [
'jquery.tablesorter.min.js',
'jquery.tablesorter.widgets.min.js',
'widgets/widget-grouping.min.js'
],
expand: true,
dest: 'js/',
flatten: true
}
]
},
},
{
cwd: 'bower_components/jqwidgets/jqwidgets/styles/',
src: [
'images/**'
],
expand: true,
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
},
jqwidgets_devel: {
files: [
{
cwd: 'bower_components/jqwidgets/jqwidgets/',
src: [
'jqx-all.js'
],
expand: true,
dest: 'js/',
flatten: true
},
{
cwd: 'bower_components/jqwidgets/jqwidgets/styles/',
src: [
'jqx.base.css',
'jqx.darkblue.css'
],
expand: true,
dest: 'css/',
flatten: true
},
{
cwd: 'bower_components/jqwidgets/jqwidgets/styles/',
src: [
'images/**'
],
expand: true,
dest: 'css/'
}
]

Rafael Ostertag
committed
},
eventEmitter: {
files: [
{
cwd: 'bower_components/eventEmitter/',
src: [
'EventEmitter.min.js'
],
expand: true,
dest: typo3_js,
flatten: true
},
{
cwd: 'bower_components/eventEmitter/',
src: [
'EventEmitter.min.js'
],
expand: true,
dest: 'js/',
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'
}
},
jshint: {
all: [
'javascript/src/*.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-plain.css": "less/qfq-plain.css.less",
"extension/Resources/Public/Css/bs-tablesorter.css": "less/bs-tablesorter.less"
},
options: {
compress: true
}
},
devel: {
files: {
"css/qfq-bs.css": "less/qfq-bs.css.less",
"css/qfq-plain.css": "less/qfq-plain.css.less",
"css/bs-tablesorter.css": "less/bs-tablesorter.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'

Rafael Ostertag
committed
helpers: ['tests/jasmine/unit/helper/mock-ajax.js'],
template: 'tests/jasmine/unit/SpecRunner.tmpl'
watch: {
scripts: {
files: [
'javascript/src/Element/*.js',

Rafael Ostertag
committed
tasks: ['default'],
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']);

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