Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update asset host URL #90

Merged
merged 1 commit into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ I give this plugin two :+1:!

## Emoji images

For GitHub Pages sites built on GitHub.com, emoji images are served from the GitHub.com CDN, with a base URL of `https://assets-cdn.github.com`, which results in emoji image URLs like `https://assets-cdn.github.com/images/icons/emoji/unicode/1f604.png`.
For GitHub Pages sites built on GitHub.com, emoji images are served from the GitHub.com CDN, with a base URL of `https://github.githubassets.com`, which results in emoji image URLs like `https://github.githubassets.com/images/icons/emoji/unicode/1f604.png`.

On GitHub Enterprise installs, page builds receive the `ASSET_HOST_URL` environment variable, which contain a value like `https://assets.ghe.my-company.com`. This results in emoji images for GitHub Pages sites built on a GitHub Enterprise install being served at URLs like `https://assets.ghe.my-company.com/images/icons/emoji/unicode/1f604.png`.

Expand Down
4 changes: 2 additions & 2 deletions lib/jemoji.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

module Jekyll
class Emoji
GITHUB_DOT_COM_ASSET_HOST_URL = "https://assets-cdn.github.com"
GITHUB_DOT_COM_ASSET_HOST_URL = "https://github.githubassets.com"
ASSET_PATH = "/images/icons/"
BODY_START_TAG = "<body"
OPENING_BODY_TAG_REGEX = %r!<body(.*?)>\s*!.freeze
Expand All @@ -25,7 +25,7 @@ def emojify(doc)

# Public: Create or fetch the filter for the given {{src}} asset root.
#
# src - the asset root URL (e.g. https://assets-cdn.github.com/images/icons/)
# src - the asset root URL (e.g. https://github.githubassets.com/images/icons/)
#
# Returns an HTML::Pipeline instance for the given asset root.
def filter_with_emoji(src)
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="/css/screen.css">
</head>
<body class="wrap">
<p><img class="emoji" title=":+1:" alt=":+1:" src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f44d.png" height="20" width="20"></p>
<p><img class="emoji" title=":+1:" alt=":+1:" src="https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png" height="20" width="20"></p>

</body>

Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/index_without_body_attributes.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="/css/screen.css">
</head>
<body>
<p><img class="emoji" title=":+1:" alt=":+1:" src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f44d.png" height="20" width="20"></p>
<p><img class="emoji" title=":+1:" alt=":+1:" src="https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png" height="20" width="20"></p>

</body>

Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/minified_index.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!DOCTYPE HTML><html lang="en-US"><head><meta charset="UTF-8"><title>Jemoji Minified</title><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="stylesheet" href="/css/screen.css"></head><body class="wrap"><p><img class="emoji" title=":+1:" alt=":+1:" src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f44d.png" height="20" width="20"></p>
<!DOCTYPE HTML><html lang="en-US"><head><meta charset="UTF-8"><title>Jemoji Minified</title><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="stylesheet" href="/css/screen.css"></head><body class="wrap"><p><img class="emoji" title=":+1:" alt=":+1:" src="https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png" height="20" width="20"></p>
</body></html>
2 changes: 1 addition & 1 deletion spec/fixtures/minified_index_without_body_attributes.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!DOCTYPE HTML><html lang="en-US"><head><meta charset="UTF-8"><title>Plain Jemoji Minified</title><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="stylesheet" href="/css/screen.css"></head><body><p><img class="emoji" title=":+1:" alt=":+1:" src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f44d.png" height="20" width="20"></p>
<!DOCTYPE HTML><html lang="en-US"><head><meta charset="UTF-8"><title>Plain Jemoji Minified</title><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="stylesheet" href="/css/screen.css"></head><body><p><img class="emoji" title=":+1:" alt=":+1:" src="https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png" height="20" width="20"></p>
</body></html>
2 changes: 1 addition & 1 deletion spec/jemoji_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
end
let(:emoji) { described_class }
let(:site) { Jekyll::Site.new(configs) }
let(:default_src) { "https://assets-cdn.github.com/images/icons/" }
let(:default_src) { "https://github.githubassets.com/images/icons/" }
let(:result) do
<<-STR.strip
<img class="emoji" title=":+1:" alt=":+1:" src="#{default_src}emoji/unicode/1f44d.png" height="20" width="20">
Expand Down