Sign in Join
Wiki copytemporary

pas2js minifier

Overview

This page explains ways to reduce and/or compress the pas2js generated JavaScript.

For a complete list of optimizations, including ideas not yet implemented, see Pas2js optimizations

Omit unneeded code

Third party minifier

There are several free minifiers for JavaScript. A minifier removes unneeded characters and replaces some code without changing its functionality.

Sourcemaps: Keep in mind that third party minifiers usually makes the source map of pas2js unusable, so use the third party minifier only for the release version.

As an example here is how to use uglifyjs with pas2js:

Windows

text
npm install uglify-js -g

and press <enter> This will download and install uglifyjs as a command line app. Test it by typing

text
uglifyjs -h

This should give the list of uglifyjs options.

Linux/MacOS

text
sudo npm install uglify-js -g

This will download and install uglifyjs as a command line app. Test it by typing

text
uglifyjs -h

This should give the list of uglifyjs options.


From the Free Pascal wiki, page "pas2js minifier", as it stood on 2021-03-28 after a change by Mattias2, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .

Edited on wiki.freepascal.org by 2 people, 2018–2021

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
Mattias2Started tipps and tricks for reducing js code size
Mattias2Third party minifier
Mattias2Linux/MacOS
Mattias2Linux/MacOS
Mattias2Windows
Mattias2Linux/MacOS
Mattias2Third party minifier
SkalogryzLinux/MacOS (minor)
Mattias2Overview

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.