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

Add remote support in resources.Get #5255

Closed
akshaybabloo opened this issue Sep 25, 2018 · 5 comments · Fixed by #9185
Closed

Add remote support in resources.Get #5255

akshaybabloo opened this issue Sep 25, 2018 · 5 comments · Fixed by #9185

Comments

@akshaybabloo
Copy link
Contributor

It'll be nice to have a getCSS function for external URL where the caching are not in our hands and also if we want to make the CSS an inline version instead of adding a link to the external site. Maybe by doing something like:

{{ $externalCSS := .getCSS "https://fonts.googleapis.com/css?family=Space+Mono:400,700" }}
<style>
     {{ $externalCSS.Content | safeCSS }}
</style>
@akshaybabloo akshaybabloo changed the title [Feature Request]: Add support for getCSS [Feature Request]: Add support for getCSS and getJS Sep 25, 2018
@bep
Copy link
Member

bep commented Sep 25, 2018

I agree about the use case, and it has been discussed, and I guess it will eventually be implemented. But we have a fairly big API as it is, so I don't think we're going to add special getCSS etc. funcs. What I had in mind would be something like this:

{{ $externalCSS := resources.Get "https://fonts.googleapis.com/css?family=Space+Mono:400,700" }}
<style>
     {{ $externalCSS.Content | safeCSS }} Or .RelPermalink would also work.
</style>

Which would work like you would expect it to. There may be licensing issues with the above construct, but I'm not sure Hugo should be the gatekeeper of those problems.

@bep bep changed the title [Feature Request]: Add support for getCSS and getJS Add remote support in resources.Get Sep 25, 2018
@bep bep added this to the v0.50 milestone Sep 25, 2018
@akshaybabloo
Copy link
Contributor Author

Ya that'll be fine too

@bep
Copy link
Member

bep commented Sep 26, 2018

I can also add to the above that I would also love to, eventually, move getJSON and getCSV into that same function ... if possible.

@bep bep modified the milestones: v0.50, v0.51 Oct 6, 2018
@bep bep modified the milestones: v0.51, v0.53 Nov 8, 2018
@bep bep modified the milestones: v0.53, v0.54 Dec 6, 2018
@bep bep modified the milestones: v0.54, v0.55 Dec 26, 2018
@bep bep modified the milestones: v0.55, v0.56 Feb 1, 2019
tryzniak added a commit to tryzniak/hugo that referenced this issue Feb 9, 2019
It'll let developers use inline CSS as in the example below:

```
{{ $externalCSS := resources.Get "https://fonts.googleapis.com/css?family=Space+Mono:400,700" }}
<style>
     {{ $externalCSS.Content | safeCSS }} Or .RelPermalink would also work.
</style>
```

Closes gohugoio#5255
tryzniak added a commit to tryzniak/hugo that referenced this issue Feb 9, 2019
It'll let developers use inline CSS as in the example below:

```
{{ $externalCSS := resources.Get "https://fonts.googleapis.com/css?family=Space+Mono:400,700" }}
<style>
     {{ $externalCSS.Content | safeCSS }} Or .RelPermalink would also work.
</style>
```

Closes gohugoio#5255
@stale
Copy link

stale bot commented Jun 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Jun 1, 2019
@bep bep added the Keep label Jun 1, 2019
@stale stale bot removed the Stale label Jun 1, 2019
@bep bep modified the milestones: v0.56, v0.57 Jun 14, 2019
@bep bep modified the milestones: v0.57, v0.58 Jul 31, 2019
@bep bep removed this from the v0.58 milestone Aug 13, 2019
@bep bep added this to the v0.77 milestone Oct 6, 2020
@bep bep modified the milestones: v0.77, v0.78 Oct 30, 2020
@bep bep modified the milestones: v0.78, v0.83 Apr 23, 2021
@bep bep modified the milestones: v0.83, v0.84 May 1, 2021
@bep bep modified the milestones: v0.84, v0.85 Jun 18, 2021
@bep bep modified the milestones: v0.85, v0.86 Jul 5, 2021
@bep bep modified the milestones: v0.86, v0.87, v0.88 Jul 26, 2021
@bep bep modified the milestones: v0.88, v0.89 Sep 2, 2021
@bep bep modified the milestones: v0.89, v0.90 Nov 2, 2021
vanbroup added a commit to vanbroup/hugo that referenced this issue Nov 18, 2021
vanbroup added a commit to vanbroup/hugo that referenced this issue Nov 18, 2021
vanbroup added a commit to vanbroup/hugo that referenced this issue Nov 18, 2021
@bep bep closed this as completed in #9185 Nov 30, 2021
bep pushed a commit that referenced this issue Nov 30, 2021
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.