misoproject / dataset

JavaScript library that makes managing the data behind client-side visualisations easy
http://misoproject.com
GNU General Public License v2.0
1.18k stars 99 forks source link

Added require.js and amd support. #174

Closed iros closed 12 years ago

iros commented 12 years ago

Fixes #166 Added require support. Note this is only in the non dependency builds. This is because the whole point is for require.js to manage dependencies. You must include moment.js and lodash/underscore yourself as dependencies.

xseignard commented 11 years ago

Hello, I'm wondering what's wrong with my require js definition (I'm pretty new to require AND miso), Miso will be undefined (the setup for jquery is ok)

Any idea?

Regards,

Xavier

require.config({
    // base url for vendor libs
    // files present : jquery.js, lodash.js, miso.ds.js, moment.js, underscore.deferred.js, underscore.math.js
    baseUrl: 'js/lib',
    // app components are stored in the js/app folder, so they'll start with 'app/'
    paths: {
        app: '../app',
    },

    shim: {
        // miso.ds shim, with its dependencies
        'miso.ds' : {
            deps : ['lodash', 'moment', 'underscore.deferred', 'underscore.math'],
            exports: 'Miso'
        }
    }
});

// start the main app logic.
require(['jquery', 'miso.ds'],
function ($, Miso) {
    console.log($);
    console.log(Miso);
});
iros commented 11 years ago

You are correct. I will have a fix shortly and will post it here.

-- Irene

On Mon, Nov 19, 2012 at 3:25 PM, Xavier Seignard notifications@github.comwrote:

Hello, I'm wondering what's wrong with my require js definition (I'm pretty new to require AND miso), Miso will be undefined (the setup for jquery is ok)

Any idea?

Regards,

Xavier

require.config({ // base url for vendor libs // files present : jquery.js, lodash.js, miso.ds.js, moment.js, underscore.deferred.js, underscore.math.js baseUrl: 'js/lib', // app components are stored in the js/app folder, so they'll start with 'app/' paths: { app: '../app', },

shim: {
    // miso.ds shim, with its dependencies
    'miso.ds' : {
        deps : ['lodash', 'moment', 'underscore.deferred', 'underscore.math'],
        exports: 'Miso'
    }
}});

// start the main app logic.require(['jquery', 'miso.ds'],function ($, Miso) { console.log($); console.log(Miso);});

— Reply to this email directly or view it on GitHubhttps://github.com/misoproject/dataset/pull/174#issuecomment-10529437.

iros commented 11 years ago

@xseignard I have updated our builds (note I bumped up the version to 0.4.1.) You can see a sample config.js file here: https://github.com/misoproject/dataset/wiki/How-Do-I...#wiki-requirejs

Miso.Dataset is now also available on JamJS thanks to @tbranyen's amazing help. Thanks.

xseignard commented 11 years ago

@iros wow! quick and clean! Thanks! And I really should give a try to jam. Kind regards

iros commented 11 years ago

You got it @xseignard =)