Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does electron-builder minify code or do I have to do that myself?

Tags:

My electron application is getting bigger and bigger, with lots of HTML, JS and CSS source files. What I need to know is if when creating the distribution with electron-builder by running yarn dist, the JS/CSS files are minified?

Do I have to do this before myself if it's worth it? Can I add this middle step in here?

"scripts": {
  "start": "electron .",
  "pack": "electron-builder --dir",
  "dist": "electron-builder",
  "postinstall": "electron-builder install-app-deps"
},

I use Visual Studio Code and could use Gulp but I need to know if there's some other method most people use, if they do care about minifying/obfuscating code. I would prefer not to separate my scripts into two folders and minify from one to another. Maybe there's a tool that does this at creating the distribution

like image 268
bMain Avatar asked Jun 01 '18 06:06

bMain


People also ask

How do you minify a code?

Go to minifycode.com and click the CSS minifier tab. Then paste the CSS code into the input box and click the Minify CSS button. After the new minified code is generated, copy the code. Then go back to the css file of your website and replace the code with the new minified version.

Should you minify your JS?

Despite being an excellent programming language, JavaScript impacts web pages by slowing them down. To regain space and improve your page load speed, you must minify the JavaScript code. The minified version of JavaScript code can reduce the file size by as much as 30–90%.

Why do we need to minify code?

Minification is the process of minimizing code and markup in your web pages and script files. It's one of the main methods used to reduce load times and bandwidth usage on websites. Minification dramatically improves site speed and accessibility, directly translating into a better user experience.

How does Electron-builder work?

electron-builder builds the Electron app for the current platform and current architecture as the default target. Linux: If you build on Windows or macOS, Snap and AppImage for x64 will be the output. Otherwise if you build on Linux, the output will be Snap and AppImage files for the current architecture.


1 Answers

The code isn't minified, as said in this issue comment, so you have to minify it yourself using UglifyJS for example.

like image 165
ClementNerma Avatar answered Sep 28 '22 19:09

ClementNerma