Sign in Join
Wiki copytemporary

Revision 1 of 2, by Mattias2 on 3-28-2021. The page as it is now.

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

npm install uglify-js -g

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

uglifyjs -h

This should give the list of uglifyjs options.

Linux/MacOS

sudo npm install uglify-js -g

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

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.