robwierzbowski / jekyll-image-tag

Better images for Jekyll.
BSD 3-Clause "New" or "Revised" License
98 stars 26 forks source link

Allow images' URLs to be prefixed with anything #13

Closed fregante closed 10 years ago

fregante commented 10 years ago

This will allow pulling images from a different domain, like requested in #11

Just define the prefix in _config.yml like this, without a trailing slash:

image:
  source: assets/images
  output: assets/images
  url_prefix: http://yoursecondarydomain.com
robwierzbowski commented 10 years ago

These are all awesome PRs. Instead of using a URL prefix config, do you think it would be better to allow source to take either a path or a URL, and deal with the differences internally?

On Saturday, March 1, 2014, Federico Brigante notifications@github.com wrote:

This will allow pulling images from a different domain, like requested in

11 https://github.com/robwierzbowski/jekyll-image-tag/issues/11

Just define the prefix in _config.yml like this, without a trailing slash:

image: source: assets/images output: assets/images url_prefix: http://yoursecondarydomain.com


You can merge this Pull Request by running

git pull https://github.com/bfred-it/jekyll-image-tag patch-2

Or view, comment on, or merge it at:

https://github.com/robwierzbowski/jekyll-image-tag/pull/13 Commit Summary

  • Allow images' URLs to be prefixed with anything

File Changes

  • M image_tag.rbhttps://github.com/robwierzbowski/jekyll-image-tag/pull/13/files#diff-0(5)

Patch Links:

Reply to this email directly or view it on GitHubhttps://github.com/robwierzbowski/jekyll-image-tag/pull/13 .

Rob Wierzbowski @robwierzbowski http://twitter.com/#!/robwierzbowski http://github.com/robwierzbowski http://robwierzbowski.com

robwierzbowski commented 10 years ago

Ah wait, I see. This is for a CDN prefix, not an external source.

Personally I would upload images to a cdn as part of a build process, and let that build process also replace the urls in the html with the new CDN prefixed URLS (like grunt-cdn does).

@altumICT, do you manually upload images to a CDN, or do you use some sort of automatic process to move your asset files?

altumICT commented 10 years ago

Thanks for this change @bfred-it. I will test this next week, but have confidence that it is the solution that I need.

@robwierzbowski I use CloudFlare as CDN provider which fetches the static content from the website. Not all my websites use/need a CDN, but they all load the assets from a cookieless domain to avoid the request overhead.

robwierzbowski commented 10 years ago

How do you normally change the utils after you upload to cloudflare? My worry is one tool doing too many jobs; if there's a way to use a single tool to do all asset prefixing I would prefer to recommend that. But this is a small change so I'm not against it, just being careful.

On Sunday, March 2, 2014, altumICT notifications@github.com wrote:

Thanks for this change @bfred-it https://github.com/bfred-it. I will test this next week, but have confidence that it is the solution that I need.

@robwierzbowski https://github.com/robwierzbowski I use CloudFlare as CDN provider which fetches the static content from the website. Not all my websites use/need a CDN, but they all load the assets from a cookieless domain to avoid the request overhead.

Reply to this email directly or view it on GitHubhttps://github.com/robwierzbowski/jekyll-image-tag/pull/13#issuecomment-36457556 .

Rob Wierzbowski @robwierzbowski http://twitter.com/#!/robwierzbowski http://github.com/robwierzbowski http://robwierzbowski.com

altumICT commented 10 years ago

I use an environment variable on the build server to build for either TEST or PROD. When initializing Jekyll, I use this environment variable to set the {{ site.assets-base }} parameter which I use everywhere I want to refer to an asset (img, css, js, ...)

So I do not change after the build, I build for a specific environment, which is a solution that I don't really like. I will take a look at grunt-cdn as well.

Thanks for the input.

robwierzbowski commented 10 years ago

Although the commits are great, I think this is too much for this one plugin to do. Closing, with many thanks for the thought.