Minification (programming): Difference between revisions

Content deleted Content added
No edit summary
Tags: Reverted Visual edit Mobile edit Mobile web edit
m Reverted edits by 2001:FB1:159:1CE3:49BA:E77C:8A5:9D4F (talk) (HG) (3.4.12)
Line 24:
 
==History==
In 2001 [[Douglas Crockford]] introduced '''JSMin''',<ref>{{Cite web |title=JSMin: The JavaScript Minifier |url=https://www.crockford.com/javascript/jsmin.html |website=Crockford.com |date=11 September 2001 |first=Douglas |last=Crockford |publisher=[[WP:SPS|Self-published]]|archive-url=https://web.archive.org/web/20020405140416/https://www.crockford.com/javascript/jsmin.html |archive-date=5 April 2002 }}</ref> which removed comments and whitespace from JavaScript code.<ref name=":1">{{Cite web |url = https://webplatform.github.io/docs/concepts/programming/javascript/minification/ |title = Code minification |website = webplatform.github.io |publisher=The WebPlatform Project |url-status = live |archive-url = https://web.archive.org/web/20160424125048/https://docs.webplatform.org/wiki/concepts/programming/javascript/minification |archive-date = 24 April 2016}}</ref> It was followed by '''YUI Compressor''' in 2007.<ref name=":1"/> In 2009, Google opened up its Closure toolkit, including '''Closure Compiler''' which contained a source mapping feature together with a Firefox extension called Closure Inspector.<ref>{{Cite web |url=https://arstechnica.com/information-technology/2009/11/google-opens-up-its-javascript-development-toolbox-to-all/ |title=Google opens up its JavaScript development toolbox to all |website=[[Ars Technica]] |first=Ryan |last=Paul |date=6 November 2009}}</ref> In 2010, Mihai Bazon introduced '''UglifyJS'''<!--Q116250477-->, which was superseded by UglifyJS2 in 2012; the rewrite was to allow for source map support.<ref>{{Cite web |url=http://lisperator.net/blog/should-you-switch-to-uglifyjs2/ |title=Should you switch to UglifyJS2? |last=Bazon |first=Mihai |website=lisperator.net |date=8 November 2012 |publisher=[[WP:SPS|Self-published]]}}</ref> From 2017, Alex Lam took over maintenance and development of UglifyJS2, replacing it with UglifyJS3 which unified the CLI with the API.<ref>{{Cite web |url=https://www.npmjs.com/package/uglify-js/v/3.0.0 |title=uglify-js NPM |website=npmjs.com |date=6 May 2017 }}</ref> In 2018, '''Terser'''<!--Q95961419--> has been forked from uglify-es<ref>{{Cite web |title=terser · JavaScript mangler and compressor toolkit for ES6+ |url=https://terser.org/ |access-date=2023-01-29 |website=terser.org}}</ref><ref>https://github.com//terser/commit/3ef6879ecafd12b57e575ec85e6104e71d5a1b6f {{bare URL inline|date=April 2023}}{{dead link|date=January 2024}}</ref> and has gained momentum since; in 2020 it outstripped UglifyJS when measured in daily downloads.<ref>{{cite web | url=https://npmtrends.com/terser-vs-uglify-js | title=Terser vs uglify-js |website= NPM trends |url-status=live |archive-url=https://archive.today/20240127214344/https://npmtrends.com/terser-vs-uglify-js |archive-date= 27 Jan 2024}}</ref>
 
==Source mapping==
Line 34:
 
===Tools===
[[Visual Studio Code|ok]]<nowiki/> comes with minification support for several languages. It can readily browse the Visual Studio Marketplace to download and install additional minifiers.
 
JavaScript optimizers can minify and generate source maps. In addition certain online tools can compress [[Cascading Style Sheets|CSS]] files.<ref>{{Cite web |last=Megida |first=Dillion |date=2022-05-18 |title=Minify CSS – CSS Minifying and Compression Explained |url=https://www.freecodecamp.org/news/minify-css-css-minifying-and-compression-explained/#howtominifycss |access-date=2024-03-29 |website=Free Code Camp |language=en}}</ref>
JavaScript optimizers can minify and generate source maps. In addition
 
===Web development===
Line 44:
 
==References==
{{Reflist}}
 
[[Category:Source code]]
[[Category:JavaScript]]