parkm / oldbpm

A JavaScript game where you shoot at bubbles.
0 stars 1 forks source link

main.js placement #12

Closed parkm closed 10 years ago

parkm commented 10 years ago

Where should main.js go? src or root?

The reason I ask is because on RequireJS. If it were in root we'd use require like:

require(['src/bpm', 'lib/thatthing']);

but if we were to put it in src we'd use it like:

require(['bpm', '../lib/thatthing']);

I don't like using '..' especially if we are to have any nested files. But for this project that probably won't happen so what do you think?

dgpt commented 10 years ago

It should go in /src. You can actually define file locations in whatever RequireJS's project file is, so we can have the best of both worlds.

require(['bpm', 'lib/thing']);

On Wed, Apr 30, 2014 at 11:30 PM, Parker Miller notifications@github.comwrote:

Where should main.js go? src or root?

The reason I ask is because on RequireJS. If it were in root we'd use require like:

require(['src/bpm', 'lib/thatthing']);

but if we were to put it in src we'd use it like:

require(['bpm', '../lib/thatthing']);

I don't like using '..' especially if we are to have any nested files. But for this project that probably won't happen so what do you think?

— Reply to this email directly or view it on GitHubhttps://github.com/despondentdonkey/bpm/issues/12 .

parkm commented 10 years ago

Oh yeah so it's always based of data-main right? So I did:

require.config({
    paths: {
        lib: '../lib/'
    }
});

so if I have root/src/adir/bdir/bob.js and in it I go:

define(['lib/greg'], function(){});

it will load

root/lib/greg.js

not

root/src/adir/lib/greg.js

since it's based on data-main which is root/src/main.js

dgpt commented 10 years ago

Yup, I'm fairly sure it works like that.

On Thu, May 1, 2014 at 12:05 PM, Parker Miller notifications@github.comwrote:

Closed #12 https://github.com/despondentdonkey/bpm/issues/12.

— Reply to this email directly or view it on GitHubhttps://github.com/despondentdonkey/bpm/issues/12 .