118 lines
3.2 KiB
JavaScript
118 lines
3.2 KiB
JavaScript
module.exports = function(grunt) {
|
|
|
|
// Project configuration.
|
|
grunt.initConfig({
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
copy: {
|
|
release: {
|
|
files: [
|
|
{ src: "node_modules/jquery/dist/jquery.min.js", dest: "htdocs/jquery.min.js" },
|
|
{ src: "node_modules/jquery-toast-plugin/dist/jquery.toast.min.js", dest: "htdocs/jquery.toast.min.js" },
|
|
{ src: "node_modules/jquery-toast-plugin/dist/jquery.toast.min.css", dest: "htdocs/jquery.toast.min.css" },
|
|
{ src: "node_modules/mustache/mustache.min.js", dest: "htdocs/mustache.min.js" },
|
|
{ cwd: "js/templates/", src:"*.mst", dest: "htdocs/", expand: true},
|
|
{ src: "node_modules/mustache/mustache.min.js", dest: "htdocs/mustache.min.js" },
|
|
]
|
|
},
|
|
static: {
|
|
files: [
|
|
{ cwd: "static/", src: "**/*", dest: "htdocs/", expand:true},
|
|
]
|
|
}
|
|
},
|
|
ts: {
|
|
default: {
|
|
src: ['ts/**/*.ts'],
|
|
outDir: 'tmp/',
|
|
options: {
|
|
module: 'none',
|
|
moduleResolution: 'node',
|
|
sourceMap: true,
|
|
target: 'es5',
|
|
rootDir: ['ts']
|
|
}
|
|
}
|
|
},
|
|
uglify: {
|
|
options: {
|
|
beautify: true,
|
|
mangle:false,
|
|
sourceMap: false
|
|
},
|
|
bootstrap: {
|
|
files: {
|
|
'htdocs/bootstrap.min.js': ['tmp/view.js','tmp/*.js'],
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
jsbootstrapts: {
|
|
files: ['ts/*.ts'],
|
|
tasks: ['ts', 'newer:uglify:bootstrap']
|
|
},
|
|
|
|
lessdefault: {
|
|
files: ['less/*.less'],
|
|
tasks: ['less']
|
|
},
|
|
concat: {
|
|
files: ['templates/base/*'],
|
|
tasks: ['concat']
|
|
},
|
|
jstemplate: {
|
|
files: ['templates/*.mst'],
|
|
tasks: ['copy']
|
|
},
|
|
json_merge: {
|
|
files: ["lang/*/*.json"],
|
|
tasks: ['json_merge']
|
|
},
|
|
static: {
|
|
files: ['static/**/*'],
|
|
tasks: ['copy:static']
|
|
},
|
|
},
|
|
less: {
|
|
default: {
|
|
options: {
|
|
"strictImports": true,
|
|
"compress": true
|
|
},
|
|
files: {
|
|
"htdocs/default.css": "less/default.less"
|
|
}
|
|
},
|
|
},
|
|
concat: {
|
|
options: {
|
|
sourceMap: false
|
|
},
|
|
base: { src: ['templates/base/*'], dest: 'htdocs/base.mst'},
|
|
},
|
|
json_merge: {
|
|
options: {
|
|
replacer: null,
|
|
space: " "
|
|
},
|
|
en: {
|
|
files: [
|
|
{ 'htdocs/en_main.json': ['lang/en/generic.json','lang/en/menu.json', 'lang/en/wifi.json', 'lang/en/error.json', 'lang/en/mapping.json', 'lang/en/main.json', 'lang/en/update.json'] },
|
|
]
|
|
}
|
|
},
|
|
});
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
grunt.loadNpmTasks('grunt-newer');
|
|
grunt.loadNpmTasks('grunt-json-merge');
|
|
grunt.loadNpmTasks("grunt-ts");
|
|
|
|
// Default task(s).
|
|
grunt.registerTask('default', ['less', 'concat', 'ts', 'newer:uglify', 'json_merge', 'copy', 'watch']);
|
|
grunt.registerTask('release', ['less', 'concat', 'ts', 'uglify', 'json_merge', 'copy']);
|
|
};
|