Skip to content

Commit c809cce

Browse files
authoredApr 9, 2019
Allow adding JavaScript files after the theme's (mmistakes#2116)
Allow adding JavaScript files after those bundled in the theme Close mmistakes#2110
1 parent d31c633 commit c809cce

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
 

‎_includes/scripts.html

+11
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,14 @@
2626

2727
{% include analytics.html %}
2828
{% include /comments-providers/scripts.html %}
29+
30+
{% if site.after_footer_scripts %}
31+
{% for script in site.after_footer_scripts %}
32+
{% if script contains "://" %}
33+
{% capture script_path %}{{ script }}{% endcapture %}
34+
{% else %}
35+
{% capture script_path %}{{ script | relative_url }}{% endcapture %}
36+
{% endif %}
37+
<script src="{{ script_path }}"></script>
38+
{% endfor %}
39+
{% endif %}

‎docs/_docs/17-javascript.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "JavaScript"
33
permalink: /docs/javascript/
44
excerpt: "Instructions for customizing and building the theme's scripts."
5-
last_modified_at: 2018-01-03T19:12:35-05:00
5+
last_modified_at: 2019-04-03T15:25:36-04:00
66
---
77

88
The theme's `assets/js/main.min.js` script is built from several vendor, jQuery plugins, and other scripts found in [`assets/js/`](https://github.com/mmistakes/minimal-mistakes/tree/master/assets/js).
@@ -39,6 +39,8 @@ head_scripts:
3939
- /assets/js/your-custom-head-script.js
4040
footer_scripts:
4141
- /assets/js/your-custom-footer-script.js
42+
after_footer_scripts:
43+
- /assets/js/custom-script-loads-after-footer.js
4244
```
4345
4446
**Note:** If you assign `footer_scripts` the theme's `/assets/js/main.min.js` file will be deactivated. This script includes jQuery and various other plugins that you'll need to find replacements for and include separately.

0 commit comments

Comments
 (0)
Please sign in to comment.