Adding r.js support #67

Closed
wants to merge 6 commits into
from

Conversation

Projects
None yet
2 participants
@headwinds
Collaborator

headwinds commented Dec 1, 2012

Hey Thomas,

in your intro you recommend r.js but don't exactly use it for the examples - at least not in the modular-backbone one. So I decided to try learn how it works using that example. After several failed attempts to configure it I finally got it working (prompting this pull request) but I'd like to get your opinion on my approach. I think there could be a better way but I don't know enough syntax for r.js - perhaps you do.

Ideally, when I build this project, I'd like the final main-built js file to appear in a separate directory with a new index.html which would use it. This separate directory would also have the supporting images and css folders. Instead of a separate directory, I ended with a simply main-built.js file and then I manually had to create a index-prod.html file to use and all this source is in the same "modular-backbone" directory.

How would one setup the build.js to produce this file structure within a new "app-built" directory? And give us a structure something like this:

modular-backbone-built
| index.html
|| scripts
||| main-built.js
|| css
||| style.css
|| imgs

or what would you recommend?

@thomasdavis

This comment has been minimized.

Show comment
Hide comment
@thomasdavis

thomasdavis Dec 3, 2012

Owner

Hey Brandon, bit stressed for time right now so will come back to this in a few days.

In the mean time here are two examples

https://github.com/thomasdavis/backboneboilerplate/tree/gh-pages/build
https://github.com/apiengine/apiengine-client/tree/master/build

Neither of them are as elegant as I'd like but I will work with you here to get something beautiful.

Owner

thomasdavis commented Dec 3, 2012

Hey Brandon, bit stressed for time right now so will come back to this in a few days.

In the mean time here are two examples

https://github.com/thomasdavis/backboneboilerplate/tree/gh-pages/build
https://github.com/apiengine/apiengine-client/tree/master/build

Neither of them are as elegant as I'd like but I will work with you here to get something beautiful.

an update to the nodejs-mongodb-mongoose-restify demo that actually w…
…orks against the local host from one server but obviously needs to be split into two for deployment
@headwinds

This comment has been minimized.

Show comment
Hide comment
@headwinds

headwinds Apr 5, 2013

Collaborator

feeling less stressed these days? I hope so... because I have some stuff for to review - much more than r.js support

I have another pull request as I re-worked this:
https://github.com/headwinds/backbonetutorials/tree/gh-pages/examples/nodejs-mongodb-mongoose-restify

I think I made it a bit more approachable for someone new to these concepts and focussed on getting it work locally.

I'd really like your input because the next step is to get it to work on a hosted platform - ideally Nodejitsu - where you have your other tutorials.

My local version has 1 server file - see server.js - which contains both a http server and a mongo server listening on two different ports. It works perfectly. You can start up mongodb locally; create a messages collection; and start sending and receiving messages.

Then, for my nodejitsu attempt, I decided to break that file into two distinct apps (see server-http.js and server-mongo.js); inspired by one of your cryptic comments ;-D I have a http app that serves up the html/js/css to the browser and another app that deals with mongo. In my logs, I can see that the two apps are talking to each other - receiving the messages - but they aren't getting saved and returned from mongohq.

Anyways, please pull and poke around a bit -- I'm confident that the local version will be helpful and it shouldn't take much more effort to get the nodejitsu version rocking too.

Collaborator

headwinds commented Apr 5, 2013

feeling less stressed these days? I hope so... because I have some stuff for to review - much more than r.js support

I have another pull request as I re-worked this:
https://github.com/headwinds/backbonetutorials/tree/gh-pages/examples/nodejs-mongodb-mongoose-restify

I think I made it a bit more approachable for someone new to these concepts and focussed on getting it work locally.

I'd really like your input because the next step is to get it to work on a hosted platform - ideally Nodejitsu - where you have your other tutorials.

My local version has 1 server file - see server.js - which contains both a http server and a mongo server listening on two different ports. It works perfectly. You can start up mongodb locally; create a messages collection; and start sending and receiving messages.

Then, for my nodejitsu attempt, I decided to break that file into two distinct apps (see server-http.js and server-mongo.js); inspired by one of your cryptic comments ;-D I have a http app that serves up the html/js/css to the browser and another app that deals with mongo. In my logs, I can see that the two apps are talking to each other - receiving the messages - but they aren't getting saved and returned from mongohq.

Anyways, please pull and poke around a bit -- I'm confident that the local version will be helpful and it shouldn't take much more effort to get the nodejitsu version rocking too.

@thomasdavis

This comment has been minimized.

Show comment
Hide comment
@thomasdavis

thomasdavis Apr 30, 2013

Owner

Hey, looking good. I've added you as a collaborator so you can just push when you see fit in the future.

Running a version up now.

I've got a full site re-work planned for the very near future too.

Owner

thomasdavis commented Apr 30, 2013

Hey, looking good. I've added you as a collaborator so you can just push when you see fit in the future.

Running a version up now.

I've got a full site re-work planned for the very near future too.

@headwinds

This comment has been minimized.

Show comment
Hide comment
@headwinds

headwinds May 1, 2013

Collaborator

awesome thanks! I'm going to review that update on the weekend again as I made a lot more progress since that post - I also want to explore a few more ways to use Restify and Mongoose - I'll try to commit it on sunday.

I actually like the existing site ;-D -- your time might be better spent on a little retro fitting instead of a complete overhaul

Collaborator

headwinds commented May 1, 2013

awesome thanks! I'm going to review that update on the weekend again as I made a lot more progress since that post - I also want to explore a few more ways to use Restify and Mongoose - I'll try to commit it on sunday.

I actually like the existing site ;-D -- your time might be better spent on a little retro fitting instead of a complete overhaul

@headwinds

This comment has been minimized.

Show comment
Hide comment
@headwinds

headwinds May 4, 2013

Collaborator

I've made my commit and it looks like they landed here ok - I'm going to delete my forked repo and do some more testing tomorrow. Along with a couple mongoose updates, I've just added yeoman support ( I was using MAMP ) which gives one live reload. This basically eliminates the need for a local static http server but of course you may still one when you go to host it remotely so I've left it in just in case it becomes necessary.

Collaborator

headwinds commented May 4, 2013

I've made my commit and it looks like they landed here ok - I'm going to delete my forked repo and do some more testing tomorrow. Along with a couple mongoose updates, I've just added yeoman support ( I was using MAMP ) which gives one live reload. This basically eliminates the need for a local static http server but of course you may still one when you go to host it remotely so I've left it in just in case it becomes necessary.

@headwinds headwinds closed this May 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment