Content deleted Content added
Beninaniy29 (talk | contribs) mNo edit summary Tags: Reverted Mobile edit Mobile app edit iOS app edit |
|||
(48 intermediate revisions by 30 users not shown) | |||
Line 1:
{{short description|Removal of unnecessary characters in code without changing its functionality}}
{{other uses|Minimisation (disambiguation){{!}}Minimisation}}
{{Redirect|Terser|the basic topic|terseness}}
{{Use dmy dates|date=September
'''Minification''' (also '''minimisation''' or '''minimization''') is the process of removing all unnecessary characters from the [[source code]] of [[Interpreted language|interpreted programming languages]] or [[markup language]]s without changing its functionality. These unnecessary characters usually include
Minification can be distinguished from the more general concept of [[data compression]] in that the minified source can be interpreted immediately without the need for
The goals of minification are not the same as the goals of [[Obfuscated code|obfuscation]]; the former is often intended to be reversed using a [[pretty-print]]er{{citation needed|date=July 2020}} or unminifier. However, to achieve its goals, minification sometimes uses techniques also used by [[obfuscation]]; for example, shortening variable names and refactoring the [[source code]]. When minification uses such techniques, the [[pretty-print]]er or unminifier can only fully reverse the minification process if it is supplied details of the transformations done by such techniques. If not supplied those details, the reversed [[source code]] will contain different variable names and control flow, even though it will have the same functionality as the original [[source code]].
==Example==
Line 18 ⟶ 19:
</syntaxhighlight>
is equivalent to but longer than
<syntaxhighlight lang="
for(var a=[],i=0
</syntaxhighlight>
==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
==Source mapping==
A '''
The original format was created by Joseph Schorr as part of the Closure Inspector minification project.<ref name=":0">{{Cite web|date=2011-01-11|title=Source Map Revision 3 Proposal|url=https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit|url-status=dead|archive-url=https://
==Types==
Line 35 ⟶ 36:
[[Visual Studio Code]] 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>
===Web development===
Components and libraries for [[Web application]]s and websites have been developed to optimize file requests and reduce page load times by shrinking the size of various files.
JavaScript and [[Cascading Style
==References==
|