2013-10-21 15:44:09 +02:00
|
|
|
/*global module:false*/
|
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
// Metadata.
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
|
|
|
|
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
|
|
|
|
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
|
|
|
|
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
|
|
|
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
|
|
|
|
concat: {
|
|
|
|
options: {
|
|
|
|
// separator: ';'
|
|
|
|
},
|
2013-10-23 06:49:14 +02:00
|
|
|
js: {
|
2013-10-21 15:44:09 +02:00
|
|
|
src: [
|
2013-10-22 12:04:46 +02:00
|
|
|
'js_src/SettingsWindow.js',
|
|
|
|
'js_src/UpdatePanel.js',
|
2013-10-23 06:49:14 +02:00
|
|
|
'js_src/Help.js',
|
2013-10-22 12:04:46 +02:00
|
|
|
'js_src/d3dServerInterfacing.js',
|
|
|
|
'js_src/verticalShapes.js',
|
|
|
|
'js_src/buttonbehaviors.js',
|
|
|
|
'js_src/canvasDrawing.js',
|
|
|
|
'js_src/previewRendering.js',
|
|
|
|
'js_src/gcodeGenerating.js',
|
|
|
|
'js_src/init_layout.js',
|
|
|
|
'js_src/Printer.js',
|
|
|
|
'js_src/Progressbar.js',
|
|
|
|
'js_src/Thermometer.js',
|
|
|
|
'js_src/utils.js',
|
|
|
|
'js_src/sidebar.js',
|
|
|
|
'js_src/Message.js',
|
|
|
|
'js_src/main.js'
|
2013-10-21 15:44:09 +02:00
|
|
|
],
|
|
|
|
dest: 'www/js/<%= pkg.name %>.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
options: {
|
|
|
|
// banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
|
2013-10-22 12:04:46 +02:00
|
|
|
mangle: true,
|
2013-10-21 15:44:09 +02:00
|
|
|
beautify: false,
|
|
|
|
compress: {},
|
2013-10-23 06:49:14 +02:00
|
|
|
// report: 'min',
|
2013-10-21 15:44:09 +02:00
|
|
|
preserveComments: 'false'
|
|
|
|
},
|
2013-10-23 06:49:14 +02:00
|
|
|
js: {
|
2013-10-22 12:04:46 +02:00
|
|
|
files: {
|
|
|
|
'www/js/<%= pkg.name %>.min.js' : ['www/js/<%= pkg.name %>.js']
|
|
|
|
}
|
2013-10-23 06:49:14 +02:00
|
|
|
},
|
|
|
|
jslibs: {
|
|
|
|
cwd: "js_src/libs/",
|
|
|
|
// src: ['js_src/libs/*.js', '!js_src/libs/*.min.js'], // source files mask
|
|
|
|
src: ['*.js', '!*.min.js'], // source files mask
|
|
|
|
dest: 'www/js/libs/', // destination folder
|
|
|
|
expand: true, // allow dynamic building
|
|
|
|
flatten: true, // remove all unnecessary nesting
|
|
|
|
ext: '.min.js' // replace .js to .min.js
|
|
|
|
// files: {
|
|
|
|
// 'www/js/<%= pkg.name %>.min.js' : ['www/js/<%= pkg.name %>.js']
|
|
|
|
// }
|
2013-10-21 15:44:09 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
jshint: {
|
|
|
|
options: {
|
|
|
|
globals: {
|
|
|
|
jQuery: true
|
|
|
|
},
|
|
|
|
browser: true,
|
|
|
|
curly: true,
|
|
|
|
eqeqeq: true,
|
|
|
|
immed: true,
|
|
|
|
latedef: true,
|
|
|
|
newcap: true,
|
|
|
|
noarg: true,
|
|
|
|
sub: true,
|
|
|
|
undef: true,
|
|
|
|
unused: true,
|
|
|
|
boss: true,
|
|
|
|
eqnull: true
|
|
|
|
},
|
|
|
|
// gruntfile: {
|
|
|
|
// src: 'Gruntfile.js'
|
|
|
|
// },
|
|
|
|
lib_test: {
|
|
|
|
src: ['www/js/*.js', '!www/js/<%= pkg.name %>.js', '!www/js/<%= pkg.name %>.min.js']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
less: {
|
|
|
|
development: {
|
|
|
|
options: {
|
|
|
|
paths: ["www/css"]
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
"www/css/styles.css": "less/styles.less"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2013-10-22 12:04:46 +02:00
|
|
|
javascript: {
|
|
|
|
files: ["js_src/*", '!www/js/<%= pkg.name %>.min.js', '!www/js/<%= pkg.name %>.js'],
|
2013-10-23 06:49:14 +02:00
|
|
|
tasks: ["concat:js", "uglify:js"]
|
|
|
|
// tasks: ["jshint", "concat", "uglify"]
|
|
|
|
},
|
|
|
|
javascriptLibs: {
|
|
|
|
files: ["js_src/libs/*"],
|
|
|
|
tasks: ["uglify:jslibs"]
|
2013-10-22 12:04:46 +02:00
|
|
|
// tasks: ["jshint", "concat", "uglify"]
|
|
|
|
},
|
2013-10-21 15:44:09 +02:00
|
|
|
styles: {
|
|
|
|
files: ["less/*"],
|
|
|
|
tasks: ["less", "autoprefixer", "cssmin"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
autoprefixer: {
|
|
|
|
options: {
|
|
|
|
browsers: ['> 1%', 'last 2 versions', 'ie 8', 'ie 9', 'ff 17', 'opera 12.1']
|
|
|
|
},
|
|
|
|
// prefix all specified files and save them separately
|
|
|
|
single_file: {
|
|
|
|
options: {},
|
|
|
|
// expand: true,
|
|
|
|
// flatten: true,
|
|
|
|
src: 'www/css/styles.css', // -> src/css/file1.css, src/css/file2.css
|
|
|
|
dest: 'www/css/styles.css' // -> dest/css/file1.css, dest/css/file2.css
|
|
|
|
}
|
|
|
|
},
|
|
|
|
cssmin: {
|
|
|
|
minify: {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'www/css/',
|
|
|
|
src: ['*.css', '!*.min.css'],
|
|
|
|
dest: 'www/css/',
|
|
|
|
ext: '.min.css'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// These plugins provide necessary tasks.
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-autoprefixer');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
|
|
|
|
|
|
|
// Default task.
|
|
|
|
grunt.registerTask('default', [
|
|
|
|
'less',
|
|
|
|
'autoprefixer',
|
|
|
|
'cssmin',
|
2013-10-22 12:04:46 +02:00
|
|
|
'concat',
|
|
|
|
'uglify',
|
2013-10-21 15:44:09 +02:00
|
|
|
// 'jshint',
|
|
|
|
'watch'
|
|
|
|
]);
|
|
|
|
|
|
|
|
};
|