DEV Community

Ross Henderson
Ross Henderson

Posted on

Javascript File Concatenation

Hey guys,

I'm wanting to use SweetAlert2 in one of my applications but I'm having a problem with the JS files. The developers for SweetAlert2 have several JS files that seem to group relevant JS together. But I'm using Oracle APEX, and it doesn't quite allow the JS files to reference each other as they do (because they assume they're in the same directory).

Can anyone give me pointers on how to concatenate these files or if there's an easier way to do it? It'll have to be one file at the end.

Latest comments (3)

Collapse
 
darksmile92 profile image
Robin Kretzschmar

Just took a quick look at it and the Readme has a line to include a minified version:
SweetAlert2 Repo

The important part is the URL of the CDN file:

Installation

...

<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>

...

<script src="sweetalert2/dist/sweetalert2.all.min.js"></script>

...

<script src="sweetalert2/dist/sweetalert2.min.js"></script>
<link rel="stylesheet" href="sweetalert2/dist/sweetalert2.min.css">

So you can download the file from there and have your combined file locally without any effort.

Collapse
 
scottishross profile image
Ross Henderson

Holy... I completely missed that! Cheers!

Collapse
 
darksmile92 profile image
Robin Kretzschmar

You're welcome :)