Browse Source

Fixing the min naming scheme

environments/production/deployments/3
Drew Short 7 years ago
parent
commit
9f28552bfd
  1. 5
      gruntfile.js

5
gruntfile.js

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

Loading…
Cancel
Save