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

Minification feature #11

Open
3 of 7 tasks
TheJaredWilcurt opened this issue Oct 13, 2020 · 0 comments
Open
3 of 7 tasks

Minification feature #11

TheJaredWilcurt opened this issue Oct 13, 2020 · 0 comments
Labels
blocked Waiting on another issue to be resolved help wanted Extra attention is needed
Projects

Comments

@TheJaredWilcurt
Copy link
Member

TheJaredWilcurt commented Oct 13, 2020

Offer an option to minify the CSS or HTML output. This would allow red-perfume to be used more holistically as a single "all-in-one" build tool for smaller projects.

  • Evaluate CSS minification libraries
    • 🧪 - I played around with various minifiers.
    • Clean-CSS and Sass both seemed like viable options that did minimal mutating of the input CSS during minification.
    • Of the two, Sass was slightly faster, and we also have plans to add Sass support in the future, so might as well avoid extra dependencies that do the same thing.
  • Evaluate HTML minification libraries
    • 👎 - Parse5 is used for atomization, but has no minification features built in, other than AST manipulation by hand.
    • 👎 - html-minifier seems to be by-far the most popular option (there's like a million fork-and-publish npm modules of it). It ships with Clean-CSS, UglifyJS, and Relate URL, since anything can be embedded in an HTML file. So if we go this route, it sort of chooses our tooling for CSS/JS minification for us. These aren't bad choices though.
    • 👍 - html-minifier-terser - Same as above, but forked and swaps UglifyJS (ES5) for Terser (ES6+).
    • 👎 - html-crush is self-contained, which I really like, but looks to be using import x form y which would severely limit backwards Node compatibility. It is also part of a GIANT mono repo 🙄 so trying to find release history on it will be a huge fucking pain.
    • 🤷‍♀️ - I could fork off of HTML-Minifier-Terser to swap Clean-CSS for Sass. Maybe even submit a PR back to them to see if they want to make that the default. Assuming they have good tests in place, this could be a good way to evaluate both tools for the minification output.
      • Though probably possible, this doesn't seem worth the effort, probably best to just do HTML-Minifier-Terser with the Clean-CSS option built in.
  • Evaluate JS/JSON minification libraries
    • 👍 - For JSON files the built in JSON.stringify(obj) is probably all we'd need
    • 👎 - UglifyJS - Easy, old school, and doesn't support ES6+ just like me, love it, but can't use it, cuz, like seriously, it doesn't understand let or const. Sorry dude.
    • 👍 - Terser - I've used this before and it was pretty painless, nice and self-contained
  • Add it as an option to the API (I think each section of a task could have it's own minification option for JS/CSS/HTML)
  • Default should have minification turned off, but allow users to opt-in via a boolean in the API
  • Document API
  • Write tests for new code
@TheJaredWilcurt TheJaredWilcurt added the help wanted Extra attention is needed label Oct 14, 2020
@TheJaredWilcurt TheJaredWilcurt added this to backlog in Red Perfume Oct 14, 2020
@TheJaredWilcurt TheJaredWilcurt mentioned this issue Sep 2, 2021
2 tasks
@TheJaredWilcurt TheJaredWilcurt added the blocked Waiting on another issue to be resolved label Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Waiting on another issue to be resolved help wanted Extra attention is needed
Projects
Status: In Progress
Red Perfume
  
Backlog
Development

No branches or pull requests

1 participant