Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] Add package.json script to minify #30

Open
AlexJSully opened this issue Oct 24, 2024 · 0 comments
Open

[enhancement] Add package.json script to minify #30

AlexJSully opened this issue Oct 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@AlexJSully
Copy link
Member

Add a script in package.json for minifying the JavaScript files used in the eFP-Seq Browser. The minification process should prioritize compatibility with older browsers (e.g., Safari 10) without mangling parameter variables, function names, or class names.

Requirements:

  • Use either Babel or Webpack for the minification process.
  • Focus on ease of use: the script should be run from package.json with a single command for simplicity.
  • Ensure strong compatibility with older browsers (such as Safari 10).
  • Avoid renaming or mangling parameter variables, function names, or class names.

Comparison: Babel vs. Webpack:

  1. Babel:
  • Pros:
    • Simple and lightweight.
    • Ideal for transpiling modern JavaScript (ES6+) to support older browsers.
    • Can be easily set up with a minify plugin, like babel-minify, through a single script in package.json.
  • Cons:
    • May require additional setup for bundling or more complex tasks (i.e., Babel is primarily for transpiling and may need a separate bundler).
  • Best for: Projects focused on compatibility with old browsers where you only need transpiling and minification with minimal overhead.
  1. Webpack:
  • Pros:
    • More powerful, with built-in support for minification, bundling, and handling complex workflows.
    • Can handle a range of tasks like bundling multiple files and optimizing output size.
  • Cons:
    • More complex setup compared to Babel.
    • Overkill if you only need simple minification and old browser compatibility.
  • Best for: Projects needing complex build processes beyond simple minification and compatibility adjustments.

Recommendation:

For ease of use and the focus on older browser compatibility (e.g., Safari 10), Babel is recommended. It allows you to transpile and minify the code with minimal configuration. We can add a single script in package.json using the babel-minify plugin to achieve this.

Example Script:
"scripts": {"minify": "babel src --out-dir dist --presets=@babel/preset-env --plugins=babel-plugin-minify"}

@AlexJSully AlexJSully added the enhancement New feature or request label Oct 24, 2024
@AlexJSully AlexJSully changed the title [package scripts] Add package.json script to minify [enhancement] Add package.json script to minify Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant