|
|
@ -47,12 +47,13 @@ module.exports = function (grunt) { |
|
|
|
grunt.file.expand({filter: 'isDirectory'}, "dist/*").forEach(function (dir) { |
|
|
|
grunt.file.expand({filter: 'isFile'}, dir + "/*.lua").forEach(function (file) { |
|
|
|
const directory = file.substr(0, file.lastIndexOf('/')); |
|
|
|
const file_name = file.substr(file.lastIndexOf('/') + 1, file.lastIndexOf('.')); |
|
|
|
const file_name = file.substr(file.lastIndexOf('/') + 1); |
|
|
|
const file_name_sans_ext = file_name.substr(0, file_name.lastIndexOf('.')); |
|
|
|
|
|
|
|
const lua = fs.readFileSync(file, 'utf8'); |
|
|
|
const minified_contents = luamin.minify(lua); |
|
|
|
|
|
|
|
const minified_file_name = file_name + '.min.lua'; |
|
|
|
const minified_file_name = file_name_sans_ext + '.min.lua'; |
|
|
|
const minified_file = directory + '/' + minified_file_name; |
|
|
|
fs.writeFileSync(minified_file, minified_contents); |
|
|
|
const file_stats = fs.statSync(file); |
|
|
|