Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    rendr-amdefinepublic

    rendr-amdefine

    AMDefine adapter for Rendr apps.

    Allows to use relative to project's root paths to match require paths on the client when you're using Rendr+RequireJS.

    Example

     
    if (typeof define !== 'function') {
      var define = require('rendr-amdefine')(module);
    }
     
    define(function(require)
    {
      // works both in node and on the client 
      var deps = [
        'app/models/property',
        'app/collections/property_search'
      ];
     
      require(deps, function()
      {
        // ... 
      });
     
    });
     

    To use within test frameworks (like jasmin) add following line to your test suite:

     
    require('rendr-amdefine').withAutoBasePath();
     

    It will set basePath as parent folder of the node_modules directory that contains rendr-amdefine.

    For the case where it's not applicable you can directly manipulate basePath by using:

     
    require('rendr-amdefine').basePath('/custom/path');
     

    install

    npm i rendr-amdefine

    Downloadslast 7 days

    1

    version

    0.0.3

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar