154 lines
5.5 KiB
Plaintext
154 lines
5.5 KiB
Plaintext
module.exports = function(grunt){
|
|
|
|
grunt.initConfig({
|
|
|
|
// clean: {dest: ['dest/*', '!dest/*.html']},
|
|
|
|
clean: {
|
|
pre : {src: ['dest/*']},
|
|
post : {src: ['src/Utils.js']}
|
|
},
|
|
|
|
coffee : {
|
|
compile : {
|
|
files : {
|
|
'src/Utils.js' : 'src/cs/*.coffee'
|
|
}
|
|
}
|
|
},
|
|
|
|
copy: {
|
|
osm: {
|
|
files: [
|
|
//{src: 'images/**', dest: 'dest/images', filter: 'isFile', expand: true, flatten: true},
|
|
//{src: 'cars/**', dest: 'dest/cars', filter: 'isFile', expand: true, flatten: true},
|
|
{src: 'src/libs/OpenLayers/img/**', dest: 'dest/img', filter: 'isFile', expand: true, flatten: true},
|
|
{ expand: true,
|
|
cwd: "src/libs/OpenLayers/theme/default/",
|
|
src: ["*.*", "**/*.*"],
|
|
dest: "./dest/theme/default/"
|
|
},
|
|
{src: 'css/**', dest: 'dest/css', filter: 'isFile', expand: true, flatten: true},
|
|
{src: 'SfmbMapsMainMap_prod.html', dest: 'dest/SfmbMapsMain.html', flatten: true},
|
|
{src: 'SfmbMapsMainMap_prod.html', dest: 'dest/SfmbMapsMainMap.html', flatten: true},
|
|
{src: 'SfmbMapsMainMap_prod.html', dest: 'dest/SfmbMapsMainSatelitte.html', flatten: true},
|
|
{src: 'SfmbMapsMainMap_prod.html', dest: 'dest/SfmbMapsMainTerrain.html', flatten: true}
|
|
|
|
]
|
|
},
|
|
|
|
google: {
|
|
|
|
files: [
|
|
//{src: 'images/**', dest: 'dest/images', filter: 'isFile', expand: true, flatten: true},
|
|
//{src: 'cars/**', dest: 'dest/cars', filter: 'isFile', expand: true, flatten: true},
|
|
{src: 'css/**', dest: 'dest/css', filter: 'isFile', expand: true, flatten: true},
|
|
{src: 'SfmbMapsMainMap_prod.html', dest: 'dest/SfmbMapsMain.html', flatten: true},
|
|
{src: 'SfmbMapsMainMap_prod.html', dest: 'dest/SfmbMapsMainMap.html', flatten: true},
|
|
{src: 'SfmbMapsMainMap_prod.html', dest: 'dest/SfmbMapsMainSatelitte.html', flatten: true},
|
|
{src: 'SfmbMapsMainMap_prod.html', dest: 'dest/SfmbMapsMainTerrain.html', flatten: true}
|
|
|
|
]
|
|
}
|
|
|
|
},
|
|
|
|
lineremover: {
|
|
//removes google library references
|
|
googleExclude: {
|
|
files: {
|
|
'dest/SfmbMapsMain.html': 'dest/SfmbMapsMain.html',
|
|
'dest/SfmbMapsMainMap.html': 'dest/SfmbMapsMainMap.html',
|
|
'dest/SfmbMapsMainSatelitte.html': 'dest/SfmbMapsMainSatelitte.html',
|
|
'dest/SfmbMapsMainTerrain.html': 'dest/SfmbMapsMainTerrain.html',
|
|
},
|
|
options: {
|
|
exclusionPattern: /google/g
|
|
}
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
uglify:{
|
|
options :{
|
|
compress: {
|
|
drop_console: false,
|
|
global_defs: {
|
|
DEBUG: false
|
|
}
|
|
},
|
|
beautify:false
|
|
},
|
|
|
|
minify_dest: {
|
|
files: {
|
|
'dest/output.min.js': [
|
|
'src/libs/OpenLayers/OpenLayers.debug.js',
|
|
'src/libs/jquery-2.1.4.js',
|
|
'src/libs/lodash.js',
|
|
'src/libs/moment.js',
|
|
'src/libs/backbone.js',
|
|
'src/lib/Open',
|
|
'src/Utils.js',
|
|
'src/models.js',
|
|
'src/SfmbMapsOL.js',
|
|
'src/Parser.js'
|
|
/*,'src/tests/TestCommands.js'*/
|
|
]
|
|
}
|
|
},
|
|
minify_google: {
|
|
files: {
|
|
'dest/output.min.js': [
|
|
'src/libs/OpenLayers/OpenLayers.debug.js',
|
|
'src/libs/jquery-2.1.4.js',
|
|
'src/libs/lodash.js',
|
|
'src/libs/moment.js',
|
|
'src/libs/backbone.js',
|
|
'src/lib/Open',
|
|
'src/Utils.js',
|
|
'src/models.js',
|
|
'src/SfmbMapsGoogle.js',
|
|
'src/Parser.js'
|
|
|
|
// ,'src/tests/TestCommands.js'
|
|
]
|
|
}
|
|
}
|
|
|
|
|
|
},
|
|
|
|
compress: {
|
|
main: {
|
|
mode : 'tgz',
|
|
options: {
|
|
archive: function(){
|
|
var toReturn = 'harta';
|
|
var task = grunt.cli.tasks[0];
|
|
if (task == 'google' || task == 'osm') toReturn = toReturn + "_" + task;
|
|
return "dest/"+toReturn+".tar.gz";
|
|
}
|
|
},
|
|
files : [
|
|
{ expand:true, cwd: 'dest/', src: ['**/*']}, // makes all src relative to cwd
|
|
]
|
|
}
|
|
}
|
|
});
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
grunt.loadNpmTasks('grunt-line-remover');
|
|
grunt.loadNpmTasks('grunt-contrib-compress');
|
|
grunt.loadNpmTasks('grunt-contrib-coffee');
|
|
|
|
|
|
grunt.registerTask('osm', ['clean:pre', 'coffee', 'copy:osm', 'lineremover:googleExclude', 'uglify:minify_dest', 'compress', 'clean:post']);
|
|
grunt.registerTask('google', ['clean:pre', 'coffee', 'copy:google', 'uglify:minify_google', 'compress', 'clean:post', 'clean:post']);
|
|
|
|
};
|