-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!-- start custom footer snippets --> | ||
|
||
<!-- end custom footer snippets --> | ||
<!-- end custom footer snippets --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{% if site.footer_scripts %} | ||
{% for script in site.footer_scripts %} | ||
<script src="{{ script | relative_url }}"></script> | ||
{% endfor %} | ||
{% else %} | ||
<script src="{{ '/assets/js/main.min.js' | relative_url }}"></script> | ||
{% endif %} | ||
|
||
{% if site.search == true or page.layout == "search" %} | ||
{%- assign search_provider = site.search_provider | default: "lunr" -%} | ||
{%- case search_provider -%} | ||
{%- when "lunr" -%} | ||
{% include_cached search/lunr-search-scripts.html %} | ||
{%- when "google" -%} | ||
{% include_cached search/google-search-scripts.html %} | ||
{%- when "algolia" -%} | ||
{% include_cached search/algolia-search-scripts.html %} | ||
{%- endcase -%} | ||
{% endif %} | ||
|
||
{% include analytics.html %} | ||
{% include /comments-providers/scripts.html %} | ||
|
||
{% if site.after_footer_scripts %} | ||
{% for script in site.after_footer_scripts %} | ||
<script src="{{ script | relative_url }}"></script> | ||
{% endfor %} | ||
{% endif %} | ||
|
||
<div class="sub-footer"> | ||
<div id="skin-switch-container"> | ||
Page rendered with the <select id="skin-switch" onchange="changeSkin()"> | ||
{%- for skin in page.available_skins %} | ||
{% if skin == 'default' -%} | ||
<option value="_default.css">default</option> | ||
{%- else -%} | ||
<option value="{{ skin }}.css">{{ skin }}</option> | ||
{%- endif %} | ||
{%- endfor %} | ||
</select> skin of Minimal-Mistakes theme. | ||
</div> | ||
</div> | ||
|
||
<script> | ||
document.getElementById("skin-switch-container").style.display = "block"; | ||
var metaTag = document.getElementById("stylesheet"); | ||
var SSHref = metaTag.href; | ||
var SSName = (SSHref.substring(SSHref.lastIndexOf('/') + 1)); | ||
|
||
document.getElementById("skin-switch").value = SSName; | ||
|
||
function changeSkin() { | ||
metaTag.href = SSHref.replace(SSName, event.target.value); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
module SkinManager | ||
class << self | ||
attr_accessor :available_skins | ||
end | ||
|
||
Jekyll::Hooks.register :site, :post_read do |site| | ||
skins_dir = site.in_theme_dir("_sass", "minimal-mistakes", "skins") | ||
SkinManager.available_skins = Dir["#{skins_dir}/*.scss"].map { |i| File.basename(i, ".scss") } | ||
end | ||
|
||
Jekyll::Hooks.register [:pages, :documents], :pre_render do |doc, payload| | ||
payload["page"]["available_skins"] = SkinManager.available_skins | ||
end | ||
|
||
class SkinPage < Jekyll::PageWithoutAFile | ||
def initialize(site, skin_name) | ||
super(site, site.source, "assets/css", "#{skin_name}.scss") | ||
end | ||
end | ||
|
||
class StyleSheetGenerator < Jekyll::Generator | ||
def generate(site) | ||
SkinManager.available_skins.each do |skin_name| | ||
site.pages << SkinPage.new(site, skin_name).tap do |page| | ||
page.data["skin_name"] = skin_name | ||
page.content = <<~SCSS | ||
@import | ||
"minimal-mistakes/skins/{{ page.skin_name }}", | ||
"minimal-mistakes"; | ||
SCSS | ||
end | ||
end | ||
end | ||
end | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.