2014-09-07 09:56:17 +02:00
|
|
|
module.exports = function (grunt) {
|
|
|
|
// Initializes the Grunt tasks with the following settings
|
|
|
|
grunt.initConfig({
|
|
|
|
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2014-09-07 12:07:28 +02:00
|
|
|
|
2014-10-10 15:34:45 +02:00
|
|
|
version: '<%= pkg.version %>',
|
2014-09-07 09:56:17 +02:00
|
|
|
dist_folder: 'dist/',
|
|
|
|
source_folder: 'src/',
|
|
|
|
|
|
|
|
// A list of files, which will be syntax-checked by JSHint
|
|
|
|
jshint: {
|
2014-10-10 15:34:45 +02:00
|
|
|
src: ['Gruntfile.js', 'src/*.js'],
|
2014-09-07 09:56:17 +02:00
|
|
|
options: {
|
2014-11-15 15:34:32 +01:00
|
|
|
jshintrc: '.jshintrc'
|
2014-09-07 09:56:17 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-10-26 11:48:13 +01:00
|
|
|
watch: {
|
|
|
|
files: [
|
2014-11-16 01:29:07 +01:00
|
|
|
'src-es6/**/*.js',
|
2014-10-26 11:48:13 +01:00
|
|
|
'src/**/*.js',
|
|
|
|
'src/**/*.css',
|
|
|
|
'src/**/*.html'
|
|
|
|
],
|
|
|
|
tasks: ['dev']
|
|
|
|
},
|
|
|
|
|
2014-11-08 13:37:24 +01:00
|
|
|
qunit: {
|
|
|
|
files: ['test/**/*.html']
|
|
|
|
},
|
|
|
|
|
2014-11-01 15:34:37 +01:00
|
|
|
requirejs: {
|
|
|
|
compile: {
|
|
|
|
options: {
|
|
|
|
baseUrl: 'src/',
|
|
|
|
'paths': {
|
|
|
|
'tf': '.'
|
|
|
|
},
|
2014-11-15 15:34:32 +01:00
|
|
|
include: ['../libs/almond/almond', 'core'],
|
2014-11-01 15:34:37 +01:00
|
|
|
out: 'dist/tablefilter.js',
|
|
|
|
wrap: {
|
|
|
|
startFile: "src/start.frag",
|
|
|
|
endFile: "src/end.frag"
|
|
|
|
}/*,
|
|
|
|
optimize: 'uglify2',
|
|
|
|
preserveLicenseComments: false,
|
|
|
|
generateSourceMaps: true*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-09-07 09:56:17 +02:00
|
|
|
concat: {
|
2014-11-01 15:34:37 +01:00
|
|
|
/*js: {
|
2014-09-07 09:56:17 +02:00
|
|
|
files: [{
|
2014-10-26 11:48:13 +01:00
|
|
|
src: ['<%= source_folder %>core.js'],
|
|
|
|
dest: '<%= dist_folder %>core.js'
|
2014-09-07 09:56:17 +02:00
|
|
|
}]
|
2014-11-01 15:34:37 +01:00
|
|
|
},*/
|
2014-09-07 09:56:17 +02:00
|
|
|
css: {
|
|
|
|
files: [{
|
|
|
|
src: ['<%= source_folder %>filtergrid.css'],
|
|
|
|
dest: '<%= dist_folder %>filtergrid.css'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// and minified (source and destination files)
|
|
|
|
uglify: {
|
|
|
|
|
|
|
|
options: {
|
|
|
|
banner: '/*------------------------------------------------------------------------ \n' +
|
2014-10-10 15:34:45 +02:00
|
|
|
'\t- TableFilter v<%= version %> by Max Guglielmi \n' +
|
2014-09-07 09:56:17 +02:00
|
|
|
'\t- build date: <%= grunt.template.today() %> \n' +
|
|
|
|
'\t- http://tablefilter.free.fr \n' +
|
|
|
|
'\t- Copyright (c) 2014, Licensed under the MIT License \n' +
|
|
|
|
'------------------------------------------------------------------------*/ \n'
|
|
|
|
},
|
|
|
|
|
|
|
|
js: {
|
2014-11-01 15:34:37 +01:00
|
|
|
src: ['<%= dist_folder %>tablefilter.js'],
|
|
|
|
dest: '<%= dist_folder %>tablefilter.js'
|
2014-09-07 09:56:17 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
cssmin: {
|
|
|
|
combine: {
|
|
|
|
options: {
|
|
|
|
banner: '/*------------------------------------------------------------------------ \n' +
|
|
|
|
'\t- TableFilter stylesheet by Max Guglielmi \n' +
|
|
|
|
'\t- (build date: <%= grunt.template.today() %>) \n' +
|
|
|
|
'\t- Edit below for your projects\' needs \n' +
|
|
|
|
'------------------------------------------------------------------------*/ \n'
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
'<%= concat.css.files[0].dest %>': ['<%= concat.css.files[0].dest %>']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2014-09-07 12:07:28 +02:00
|
|
|
|
2014-09-07 09:56:17 +02:00
|
|
|
copy: {
|
2014-09-07 12:07:28 +02:00
|
|
|
main: {
|
|
|
|
files: [
|
2014-09-07 09:56:17 +02:00
|
|
|
{ src: ['**'], cwd: '<%= source_folder %>TF_Modules/', dest: '<%= dist_folder %>TF_Modules/', expand: true },
|
|
|
|
{ src: ['**'], cwd: '<%= source_folder %>TF_Themes/', dest: '<%= dist_folder %>TF_Themes/', expand: true }
|
2014-09-07 12:07:28 +02:00
|
|
|
]
|
|
|
|
}
|
2014-11-15 15:34:32 +01:00
|
|
|
},
|
2014-11-01 15:34:37 +01:00
|
|
|
|
2014-11-15 15:34:32 +01:00
|
|
|
'6to5': {
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
modules: 'amd'
|
|
|
|
},
|
|
|
|
// dist: {
|
|
|
|
// files: {
|
|
|
|
// 'es6/modules/*.js': '<%= source_folder %>modules/'
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
build:{
|
|
|
|
files: [{
|
|
|
|
expand: true,
|
2014-11-16 01:29:07 +01:00
|
|
|
cwd: 'src-es6',
|
2014-11-15 15:34:32 +01:00
|
|
|
src: ['**/*.js'],
|
2014-11-16 01:29:07 +01:00
|
|
|
dest: '<%= source_folder %>'
|
2014-11-15 15:34:32 +01:00
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2014-09-07 09:56:17 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// Load the plugins that provide the tasks we specified in package.json.
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
2014-10-26 11:48:13 +01:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
2014-11-08 13:37:24 +01:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-qunit');
|
2014-11-01 12:52:59 +01:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
2014-11-15 15:34:32 +01:00
|
|
|
grunt.loadNpmTasks('grunt-6to5');
|
2014-09-07 09:56:17 +02:00
|
|
|
|
|
|
|
// This is the default task being executed if Grunt
|
|
|
|
// is called without any further parameter.
|
2014-11-16 01:29:07 +01:00
|
|
|
grunt.registerTask('default', ['jshint', '6to5', 'requirejs', 'concat', 'uglify', 'cssmin', 'copy', 'qunit']);
|
2014-11-15 15:34:32 +01:00
|
|
|
grunt.registerTask('dev', ['jshint', '6to5', 'concat', 'cssmin', 'copy']);
|
|
|
|
grunt.registerTask('toes5', ['6to5']);
|
2014-11-08 13:37:24 +01:00
|
|
|
grunt.registerTask('test', ['qunit']);
|
2014-09-07 09:56:17 +02:00
|
|
|
};
|