1

Environment is standalone script deployed as web app with HTMLService():

function doGet() {
  return HtmlService.createTemplateFromFile('index').evaluate();
}

// see:  http://stackoverflow.com/a/39309690 
function include(filename) {
  return HtmlService.createHtmlOutputFromFile(filename)
      .getContent();
}

I can link to the Font Awesome css file in index.html like this:

<?!= include('css_font_awesome'); ?>

This will link to css_font_awesome.html which contains styles within <style> tags.

But how do I link to the .eot, .woff, .ttf and .svg files within the Font Awesome css file, ie:

@font-face {
  font-family: 'FontAwesome';
  src: url('fontawesome-webfont.eot?v=4.6.3');
  src: url('fontawesome-webfont.eot?#iefix&v=4.6.3') format('embedded-opentype'), url('fontawesome-webfont.woff2?v=4.6.3') format('woff2'), url('fontawesome-webfont.woff?v=4.6.3') format('woff'), url('fontawesome-webfont.ttf?v=4.6.3') format('truetype'), url('fontawesome-webfont.svg?v=4.6.3#fontawesomeregular') format('svg');
  font-weight: normal;
  font-style: normal;
}

1 Answer 1

3

I think you can use a CDN to include the FontAwesome stylesheet through the link tag.

Open the index.html and paste the following line in the head.

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
Sign up to request clarification or add additional context in comments.

2 Comments

That worked, thanks, it would be good to know if it's possible without using a CDN (or any other external, non-google apps domain hosting), if any later posters comes across this.
As of 10/2016 there is no hosting option in Apps Script. You would need to 3rd party host it. Firebase, App Engine, Cloud Storage are common ones used in the Apps Script community.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.