Page 1 of 1

Advice on refactoring a single page site

Posted: Tue Apr 26, 2016 5:32 pm
by thinsoldier
I started with a typical 1 file per page site and added ajaxify: http://www.barznoble.com/ (*warning*: auto-playing music)

Then I redid it as a single page using the history api: http://www.barznoble.com/2/ (no auto-playing music)

What I need is

A: for someone to look through the code of the 2nd version and give advice on how I could improve the way I have the code arranged.

B: suggest an actual front end javascript framework to rebuild it with a 3rd time.

Re: Advice on refactoring a single page site

Posted: Tue Apr 26, 2016 5:48 pm
by Christopher
Other than putting the CSS and Javascript in to separate files, that is too much code to give much advice on.

Re: Advice on refactoring a single page site

Posted: Tue Apr 26, 2016 6:44 pm
by Celauran
Minify. Separate your concerns, definitely, but minify your CSS and JS. Make sure images are optimized.

Re: Advice on refactoring a single page site

Posted: Tue Apr 26, 2016 7:05 pm
by thinsoldier
Christopher wrote:Other than putting the CSS and Javascript in to separate files, that is too much code to give much advice on.
(Referring to /2/ version) For development they are separate but I figured it might be faster to load all the html, css, and js in one shot on the live site.

I'll revert back to individual link and script tags to make it easier to digest and reply again when done.

Re: Advice on refactoring a single page site

Posted: Wed Apr 27, 2016 12:25 pm
by Christopher
thinsoldier wrote:(Referring to /2/ version) For development they are separate but I figured it might be faster to load all the html, css, and js in one shot on the live site
Instead, think of what the browser will cache. Especially for data driven pages where a parameter or session data will require that the page is sent. Having the CSS and Javascript separate greatly reduces what needs to be sent.