Coder Social home page Coder Social logo

common js compliant lib about jsrender HOT 7 CLOSED

borismoore avatar borismoore commented on June 14, 2024
common js compliant lib

from jsrender.

Comments (7)

jeffrose avatar jeffrose commented on June 14, 2024

Along the same line, it would be nice if JsRender exposed itself as an AMD module so asynchronous loaders like RequireJS and curl.js can use it. jQuery now registers itself as an AMD module as of version 1.7.

from jsrender.

BorisMoore avatar BorisMoore commented on June 14, 2024

It should now be compliant. It does not use 'window'. I'll look at the AMD registration idea, so keeping this issue open.

from jsrender.

jrburke avatar jrburke commented on June 14, 2024

If you have questions on how to pull in the AMD registration, feel free to let me know. Here is a umdjs example that may be applicable here: https://github.com/umdjs/umd/blob/master/returnExports.js

from jsrender.

jeffrose avatar jeffrose commented on June 14, 2024

Glancing through the code, it looks like if jQuery is present, methods are attached to $, otherwise they're attached to a custom object. I would think in order to do AMD registration, methods would need to be attached to the custom object under both circumstances and that object would be the one returned.

require( [ 'jsrender' ], function( jsrender ){
jsrender.render[ 'myTemplate' ]( myData );
} );

from jsrender.

BorisMoore avatar BorisMoore commented on June 14, 2024

Yes, you are right about the behavior.

I may not look more closely at AMD until JsViews and JsRender both get to Beta. (And James, yes I'll let you know if I have questions).

from jsrender.

Redsandro avatar Redsandro commented on June 14, 2024

I may not look more closely at AMD until JsViews and JsRender both get to Beta.

Any new developments on this?

from jsrender.

BorisMoore avatar BorisMoore commented on June 14, 2024

JsRender is now fully AMD and commonJs compliant - as is JsViews.

JsRender is available as a Node module. See https://www.npmjs.com/package/jsrender and https://github.com/BorisMoore/jsrender-node-starter

from jsrender.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.