2020-01-14 10:13:57 +00:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2020-01-15 05:46:35 +00:00
|
|
|
terser: {
|
|
|
|
options: {
|
|
|
|
// Task-specific options go here.
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
// Target-specific file lists and/or options go here.
|
|
|
|
src: '../resources/static/js/bundle.js',
|
|
|
|
dest: '../resources/static/js/bundle.min.js'
|
|
|
|
},
|
|
|
|
},
|
2020-01-14 10:13:57 +00:00
|
|
|
browserify: {
|
2020-01-15 05:46:35 +00:00
|
|
|
dev: {
|
|
|
|
src: 'ts/src/main.ts',
|
|
|
|
dest: '../resources/static/js/bundle.js',
|
|
|
|
options: {
|
|
|
|
browserifyOptions: {
|
|
|
|
debug: true
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
prod: {
|
2020-01-14 10:13:57 +00:00
|
|
|
src: 'ts/src/main.ts',
|
2020-01-15 05:46:35 +00:00
|
|
|
dest: '../resources/static/js/bundle.js',
|
|
|
|
banner: '/*! Chat.js <%= grunt.template.today("yyyy-mm-dd") %> */ ',
|
|
|
|
options: {
|
|
|
|
browserifyOptions: {
|
|
|
|
debug: false
|
|
|
|
},
|
|
|
|
}
|
2020-01-14 10:13:57 +00:00
|
|
|
},
|
|
|
|
options: {
|
|
|
|
plugin: [
|
2020-01-15 05:46:35 +00:00
|
|
|
['tsify', { target: 'ES6', noImplicitAny: true }], // register plugin by name
|
2020-01-14 10:13:57 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
|
2020-01-15 05:46:35 +00:00
|
|
|
browserifyOptions: {},
|
2020-01-14 10:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Load the plugin that provides the "uglify" task.
|
2020-01-15 05:46:35 +00:00
|
|
|
grunt.loadNpmTasks('grunt-terser');
|
2020-01-14 10:13:57 +00:00
|
|
|
|
|
|
|
// // Default task(s).
|
|
|
|
// grunt.registerTask('default', ['uglify']);
|
|
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-browserify')
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-15 05:46:35 +00:00
|
|
|
grunt.registerTask('default', ['browserify:dev'])
|
|
|
|
grunt.registerTask('prod', ["browserify:prod", "terser"])
|
2020-01-14 10:13:57 +00:00
|
|
|
|
|
|
|
};
|