Skip to content

Commit

Permalink
final attempt for github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
AUTplayed committed Oct 21, 2018
1 parent 006ec13 commit 3be6c45
Show file tree
Hide file tree
Showing 15 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ldf.nav("login");

You can include css and js in your html files just like normal, they will also be dynamically loaded.

For a small demonstration, check out the `docs` directory.
For a small demonstration, check out the `demo` directory, [or check it out live.](https://autplayed.github.io/ldf/demo/)

**Notes:**

Expand Down Expand Up @@ -79,6 +79,9 @@ LDF currently allows for some configuration.
ldf.notfound = "<div>Page not Found</div>";
// The directory your pages are stored on the server, default is /pages
ldf.pagedir = "/pages";
// A base url that is prepended for every navigation
// Used in my case for github pages since that has a required base url
ldf.baseurl = "";
// The css selector string LDF will wait on before displaying the page.
// By default it waits for all stylesheets and all elements with a src attribute (like images), but not scripts.
ldf.waitselector = "link[rel='stylesheet'],:not(script)[src]";
Expand All @@ -95,7 +98,7 @@ In order for the refresh function to work, you will have to include a special ca

You have to look at the request if it's not `/` but a request to a page, and send back your `index.html`. But you can't just always send back `index.html` when the requested file isn't found, unless you want your site to break if a user visits a missing page, since LDF relies on getting an error from a request to a missing page.

A small implementation of this I used in the docs/example project (with nodejs and express) looks like this:
A small implementation of this I used in the demo/example project (with nodejs and express) looks like this:

```javascript
// Static resources
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html → demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1 id="header">My Website</h1>
<script src="ldf.js"></script>
<script>
var header = document.querySelector("#header");
ldf.baseurl = "ldf"; // needed for github pages
ldf.baseurl = "ldf/demo"; // needed for github pages
ldf.begin = function () {
header.innerHTML = "My Website (loading)";
};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ldf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var ldf = {
notfound: "<div>Page not Found</div>",
waitselector: "link[rel='stylesheet'],:not(script)[src]",
pagedir: "/pages",
pagedir: "pages",
baseurl: "",
begin: undefined,
end: undefined,
Expand Down

0 comments on commit 3be6c45

Please sign in to comment.