Closed toomanylogins closed 2 years ago
Sure, see https://terser.org/html-minifier-terser and the relevant files at https://github.com/terser/html-minifier-terser/tree/master/demo
Starting v7 browser builds are distributed to npm. See https://unpkg.com/browse/html-minifier-terser@7.0.0-alpha.1/dist
Prior to v7, bundles are not distributed to npm. You can use any cdn that can import files from github. You can find the files in the dist/
directory https://github.com/terser/html-minifier-terser/tree/v6.1.0/dist
Thank you for reply. Apologies if this seems trivial. I dev db applications (4d.com). Running example code in a headless browser I cant get past this error in the web inspector.
VM216:3 ReferenceError: minify is not defined
at foo
Is the minify() the correct function to call with the source html as the first param ? Thanks
Minify is not added to global variables. If you are using via UMD builds, you will need to access via UMD namespace.
<body>
<script src="https://cdn.jsdelivr.net/npm/html-minifier-terser@7.0.0-alpha.1/dist/htmlminifier.umd.bundle.js"></script>
<script>
const minify = window.HTMLMinifier.minify;
</script>
</body>
Or For modules.
<script type="module">
import HTMLMinifier from 'https://cdn.skypack.dev/html-minifier-terser';
const minify = HTMLMinifier.minify
</script>
Thank you for trying to help. This is offline desktop application. Therefore I think i need to use something like rollup to output a script without dependencies. Is that possible ?
Is there a build of this that can be run client side in the browser thanks