Alter JavaScript from config file

Is there a way to have jekyll change the contents of a javascript file during compilation depending on the contents of the config file?

I’m working on a back end agnostic disaster response application and my group is bouncing around the idea of using Jekyll to compile the structure and then deliver the content to the page using ajax requests, but we would then need to be able to change the javascript to go to different locations for different iterations of the project since we aren’t going to have one website for all disasters.

If you add Front Matter to your JavaScript file(s) Jekyll will process it. Which then allows you to use Liquid in the file or drop in variables coming from _config.yml via site. or the page or a collection or anything else you can normally do with Jekyll.


# intentionally left blank

// your scripts here

I use this method for one of my Jekyll theme’s to build a .js file used for search data.

Fantastic! Thanks for the help