Skip to content

Commit

Permalink
Make use of 'uglify' grunt task to generate minified JS files
Browse files Browse the repository at this point in the history
  • Loading branch information
AshBardhan committed Feb 28, 2024
1 parent 0334eb2 commit 5aa0867
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 4 deletions.
11 changes: 10 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ module.exports = function (grunt) {
dest: 'memefy-this.zip'
}
},
uglify: {
'js': {
expand: true,
cwd: 'dist',
src: ['**/*.js'],
dest: 'dist/'
}
},
watch: {
'src': {
files: ['src/**'],
Expand All @@ -56,8 +64,9 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-zip');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('build', ['clean:build', 'sass', 'copy', 'zip']);
grunt.registerTask('build', ['clean:build', 'sass', 'copy', 'uglify', 'zip']);
grunt.registerTask('dev', ['clean:dev', 'sass', 'copy', 'watch']);
};
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ If you find this application much useful, show your support by all means
- Install all the required dependencies by running `yarn install`.
- Create a new branch out off `master` for your fix/feature by running `git checkout -b new-feature`.
- Build this project by running the following commands
- `grunt dev` - This creates `dist` folder containing files (unminified version) for the chrome extension and a watcher task.
- `grunt build` - This creates `dist` folder containing files (minified version) for the chrome extension and its `.zip` file (only for admin purpose).
- `grunt dev` - This creates `dist` folder containing unminified files for the chrome extension and a watcher task.
- `grunt build` - This creates `dist` folder containing minified files for the chrome extension and its compressed `.zip` file (only for admin purpose).
- Install in your chrome by loading the generated `dist` folder as an [unpacked extension](http://techapple.net/2015/09/how-to-install-load-unpacked-extension-in-google-chrome-browser-os-chromebooks/).

### Things to remember
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"grunt": "^1.3.0",
"grunt-contrib-clean": "^2.0.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-uglify": "^5.2.2",
"grunt-contrib-watch": "^1.1.0",
"grunt-sass": "^3.1.0",
"grunt-zip": "^0.17.1",
Expand Down
62 changes: 61 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ chalk@^2.4.2:
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

chalk@^4.1.2, chalk@~4.1.0:
chalk@^4.1.0, chalk@^4.1.2, chalk@~4.1.0:
version "4.1.2"
resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz"
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
Expand Down Expand Up @@ -500,6 +500,11 @@ detect-file@^1.0.0:
resolved "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz"
integrity sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==

duplexer@^0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.2.tgz#3abe43aef3835f8ae077d136ddce0f276b0400e6"
integrity sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==

eachr@^4.5.0:
version "4.5.0"
resolved "https://registry.npmjs.org/eachr/-/eachr-4.5.0.tgz"
Expand Down Expand Up @@ -595,6 +600,13 @@ faye-websocket@~0.10.0:
dependencies:
websocket-driver ">=0.5.1"

figures@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==
dependencies:
escape-string-regexp "^1.0.5"

file-sync-cmp@^0.1.0:
version "0.1.1"
resolved "https://registry.npmjs.org/file-sync-cmp/-/file-sync-cmp-0.1.1.tgz"
Expand Down Expand Up @@ -829,6 +841,16 @@ grunt-contrib-copy@^1.0.0:
chalk "^1.1.1"
file-sync-cmp "^0.1.0"

grunt-contrib-uglify@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/grunt-contrib-uglify/-/grunt-contrib-uglify-5.2.2.tgz#447c0b58451a1fca20768371e07e723a870dfe98"
integrity sha512-ITxiWxrjjP+RZu/aJ5GLvdele+sxlznh+6fK9Qckio5ma8f7Iv8woZjRkGfafvpuygxNefOJNc+hfjjBayRn2Q==
dependencies:
chalk "^4.1.2"
maxmin "^3.0.0"
uglify-js "^3.16.1"
uri-path "^1.0.0"

grunt-contrib-watch@^1.1.0:
version "1.1.0"
resolved "https://registry.npmjs.org/grunt-contrib-watch/-/grunt-contrib-watch-1.1.0.tgz"
Expand Down Expand Up @@ -912,6 +934,14 @@ grunt@^1.3.0:
minimatch "~3.0.4"
nopt "~3.0.6"

gzip-size@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-5.1.1.tgz#cb9bee692f87c0612b232840a873904e4c135274"
integrity sha512-FNHi6mmoHvs1mxZAds4PpdCS6QG8B4C1krxJsMutgxl5t3+GlRTzzI3NEkifXx2pVsOvJdOGSmIgDhQ55FwdPA==
dependencies:
duplexer "^0.1.1"
pify "^4.0.1"

hard-rejection@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz"
Expand Down Expand Up @@ -1365,6 +1395,16 @@ map-obj@^4.0.0:
resolved "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz"
integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==

maxmin@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/maxmin/-/maxmin-3.0.0.tgz#3ee9acc8a2b9f2b5416e94f5705319df8a9c71e6"
integrity sha512-wcahMInmGtg/7c6a75fr21Ch/Ks1Tb+Jtoan5Ft4bAI0ZvJqyOw8kkM7e7p8hDSzY805vmxwHT50KcjGwKyJ0g==
dependencies:
chalk "^4.1.0"
figures "^3.2.0"
gzip-size "^5.1.1"
pretty-bytes "^5.3.0"

meow@^9.0.0:
version "9.0.0"
resolved "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz"
Expand Down Expand Up @@ -1784,13 +1824,23 @@ picomatch@^2.3.1:
resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==

pify@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==

pkg-up@^3.1.0:
version "3.1.0"
resolved "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz"
integrity sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==
dependencies:
find-up "^3.0.0"

pretty-bytes@^5.3.0:
version "5.6.0"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"
integrity sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==

process-nextick-args@~2.0.0:
version "2.0.1"
resolved "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz"
Expand Down Expand Up @@ -2263,6 +2313,11 @@ typechecker@^6.2.0:
resolved "https://registry.npmjs.org/typechecker/-/typechecker-6.4.0.tgz"
integrity sha512-EbOu+9szY13mhl0EsvLXnR+pTCa3gTHQQPLdce72ujcC9fRHXlVFBNXtHeRhgzLxLlKUh4zA9C0tezLDgshf+A==

uglify-js@^3.16.1:
version "3.17.4"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c"
integrity sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==

unc-path-regex@^0.1.2:
version "0.1.2"
resolved "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz"
Expand Down Expand Up @@ -2304,6 +2359,11 @@ unique-slug@^3.0.0:
dependencies:
imurmurhash "^0.1.4"

uri-path@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/uri-path/-/uri-path-1.0.0.tgz#9747f018358933c31de0fccfd82d138e67262e32"
integrity sha512-8pMuAn4KacYdGMkFaoQARicp4HSw24/DHOVKWqVRJ8LhhAwPPFpdGvdL9184JVmUwe7vz7Z9n6IqI6t5n2ELdg==

util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
Expand Down

0 comments on commit 5aa0867

Please sign in to comment.