Picture of Pedro Ferreira
Adapt on Google Pages
by Pedro Ferreira - Friday, 28 August 2020, 9:55 AM
 

Hello,

I'm trying to serve an adapt-generated course on GitHub pages and it just doesn't work (stays on "Loading..." forever).

There are no errors, no network problems, no indication of any issues. The actual site is live on here and you can consult the generated code here.
Has anyone tried to serve a course on GitHub pages in the past? Did you manage to make it work?

Cheers,
Pedro

Picture of John Niezen
Re: Adapt on Google Pages
by John Niezen - Friday, 28 August 2020, 10:35 AM
 

Hi Pedro,

It needs to run with webserver application enabled. do not think that is possible just like that on Github. Better install it on a local webserver and allow access from there.

Zip the stuff, download and unpack, then run from the index.html

Picture of Matt Leathes
Re: Adapt on Google Pages
by Matt Leathes - Friday, 28 August 2020, 11:12 AM
 
do not think that is possible just like that on Github

You can use Github as a web server via Github Pages. Worth a look, it's very handy.

Picture of John Niezen
Re: Adapt on Google Pages
by John Niezen - Friday, 28 August 2020, 11:44 AM
 

Thanks for the tip Matt, learning everyday something new.

Picture of Pedro Ferreira
Re: Adapt on Google Pages
by Pedro Ferreira - Friday, 28 August 2020, 11:14 AM
 

Thanks for your answer.

My understanding is that the contents of the build directory are just plain HTML + JS + CSS which will run standalone. Is that incorrect?

I actually tried to just serve those files using a regular local webserver and it just works. There should be no reason for it to not work on GitHub pages if that's the case...

Picture of Matt Leathes
Re: Adapt on Google Pages
by Matt Leathes - Friday, 28 August 2020, 12:13 PM
 
My understanding is that the contents of the build directory are just plain HTML + JS + CSS which will run standalone. Is that incorrect?

Yes that's right. You just need to run it from a web server (as all modern browsers now block web content from being loaded via file://)

Picture of Matt Leathes
Re: Adapt on Google Pages
by Matt Leathes - Friday, 28 August 2020, 10:43 AM
 

Yes, in fact the Adapt demo courses are hosted on GH pages, here's the v5demo for example. and here's the original repo.

Picture of Matt Leathes
Re: Adapt on Google Pages
by Matt Leathes - Friday, 28 August 2020, 11:06 AM
 

It's a little tricky to debug because you've uploaded the 'production' version so everything is minified... but if I run your course, open the developer tools and run require('core/js/adapt').build.toJSON().plugins in the console, I can see that you haven't installed any plugins (except the 'core'). So that's why it's not working.

For Adapt to be able to run you typically need one or more plugin, you can't really do very much with just the core code alone.

Your course seems to consist mostly of 'text' components, so getting adapt-contrib-text installed would be the first place to start. And, since it consists of more than one page/contentObject, you'll need a menu too.

Picture of Pedro Ferreira
Re: Adapt on Google Pages
by Pedro Ferreira - Friday, 28 August 2020, 11:18 AM
 

OK, that's weird, because if I serve that directory locally, it just works. How can I generate a development bundle? I know there's `grunt dev` but that also watches for changes.

Picture of Matt Leathes
Re: Adapt on Google Pages
by Matt Leathes - Friday, 28 August 2020, 12:10 PM
 

just press CTRL+C after running grunt dev to stop it

Is this the source you're building this from? If so, you're missing quite a bit from there... there's no components, extensions, menu or theme subfolders and in course/en there's just course.json and no other .json files or other subfolders.

Picture of Pedro Ferreira
Re: Adapt on Google Pages
by Pedro Ferreira - Friday, 28 August 2020, 12:55 PM
 

Yes, that's the source, but we use a script to populate those files at CI build time. But I'll double check, maybe there's something going wrong with it.

Thanks for your help.

 

Picture of Pedro Ferreira
Re: Adapt on Google Pages
by Pedro Ferreira - Friday, 28 August 2020, 2:35 PM
 

Mystery solved: I hadn't realized I have to do "adapt install" when deploying in CI, otherwise the plugins are not installed.
Thanks for your help!