1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-15 21:06:44 +02:00
TableFilter/Gruntfile.js

153 lines
5.3 KiB
JavaScript
Raw Normal View History

module.exports = function (grunt) {
// Initializes the Grunt tasks with the following settings
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
2014-10-10 15:34:45 +02:00
version: '<%= pkg.version %>',
dist_folder: 'dist/',
source_folder: 'src/',
// A list of files, which will be syntax-checked by JSHint
jshint: {
2014-11-23 04:34:57 +01:00
src: [
'Gruntfile.js',
'<%= source_folder %>*.js',
'!<%= source_folder %>sortabletable.js'
],
options: {
2014-11-15 15:34:32 +01:00
jshintrc: '.jshintrc'
}
},
2014-10-26 11:48:13 +01:00
watch: {
files: [
2014-11-16 01:29:07 +01:00
'src-es6/**/*.js',
2014-11-23 04:34:57 +01:00
'<%= source_folder %>**/*.js',
'<%= source_folder %>**/*.css',
'<%= source_folder %>**/*.html'
2014-10-26 11:48:13 +01:00
],
tasks: ['dev']
},
2014-11-08 13:37:24 +01:00
qunit: {
files: ['test/**/*.html']
},
requirejs: {
compile: {
options: {
2014-11-23 04:34:57 +01:00
baseUrl: '<%= source_folder %>',
'paths': {
'tf': '.'
},
2014-11-15 15:34:32 +01:00
include: ['../libs/almond/almond', 'core'],
2014-11-23 04:34:57 +01:00
out: '<%= dist_folder %>tablefilter.js',
wrap: {
startFile: "src/start.frag",
endFile: "src/end.frag"
2014-11-23 04:34:57 +01:00
},
shim: {
'SortableTable': {
exports: 'SortableTable'
}
}/*,
optimize: 'uglify2',
preserveLicenseComments: false,
generateSourceMaps: true*/
}
}
},
concat: {
/*js: {
files: [{
2014-10-26 11:48:13 +01:00
src: ['<%= source_folder %>core.js'],
dest: '<%= dist_folder %>core.js'
}]
},*/
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' +
'\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: {
src: ['<%= dist_folder %>tablefilter.js'],
dest: '<%= dist_folder %>tablefilter.js'
}
},
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 %>']
}
}
},
copy: {
main: {
files: [
2014-11-23 04:34:57 +01:00
{ src: 'libs/sortabletable.js', dest: '<%= source_folder %>/sortabletable.js' },
{ 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-11-15 15:34:32 +01:00
},
2014-11-15 15:34:32 +01:00
'6to5': {
options: {
sourceMap: true,
modules: 'amd'
},
2014-11-22 15:01:29 +01:00
build: {
2014-11-15 15:34:32 +01:00
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
}]
}
}
});
// 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');
// 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']);
};