Closed badiezadegan closed 9 years ago
Do you know what is needed to make it compatible?
I don't know exactly. But it looks jsviews is prepared for require.js modules but browserify is for node.js modules. It seems one should write a shim for jsviews to get it work with browserify.
According to http://requirejs.org/ : RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino and Node. Here is the documentation for node: http://requirejs.org/docs/node.html
I also found this text that seems very useful: http://esa-matti.suuronen.org/blog/2013/03/22/journey-from-requirejs-to-browserify/
OK. I plan to add support for bower, nodejs, AMD/require, Nuget, webjars, composer, typescript... for V1 - and I will try to make this (browserify) work too. Also, add to CDN https://cdnjs.com/. Meantime there is already a node package wrapper here https://www.npmjs.org/package/node-jsrender maintained by @coolbloke1324.
Thanks a lot.
np - but I'll reopen as a reminder to myself to do this on reaching V1.0. :)
@badiezadegan, @gbouthenot: With Commit 65, JsViews and JsRender now have built-in support for Browserify. JsRender has a built-in browserify transform for including templates - in the form of server-side html pages - in the client bundle. See https://github.com/BorisMoore/jsrender/blob/master/gulpfile.js#L9 - and in particular this line: https://github.com/BorisMoore/jsrender/blob/master/gulpfile.js#L18 - for usage.
After running the gulp task, gulp bundle
, the client bundles are created for this set of unit tests:
https://github.com/BorisMoore/jsrender/blob/master/test/unit-tests-browserify.html - or here for JsViews: https://github.com/BorisMoore/jsviews/blob/master/test/unit-tests-browserify.html.
JsRender and JsViews have full CommonJS support, so you can require them in Browserify without needing browser shims.
JsRender and JsViews also have full AMD support, see http://borismoore.github.io/jsviews/test/unit-tests-amd-scriptloader.html.
Keeping this issue open for tracking the upcoming publishing of JsRender and JsViews to NPM (with full Express and Hapi integration) as well as webjars, composer, typescript... - and registering in jQuery plugins registry also...
JsRender has now been published to NPM and Bower, and includes Browserify support with a transfrom jsrender/tmplify. See https://github.com/BorisMoore/jsrender-node-starter
Moving to #174 for tracking publishing of JsRender and JsViews to webjars, composer, typescript... - and registering in jQuery plugins registry also...
How can jsviews get compatible with browserify?