-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dependencies on core CanJS and DOM libraries to increase Node compatibility #5
Comments
I'm not sure I understand what the problem is. If you
it should be possible to run |
Flexibility and the lack thereof.
Morever, even if you are able to set this up on a build server; can-compile leans on jsdom and jsdom in turn leans on contextify, which has to be built as a native module for the platform in question. (I.e. it requires even more additional set-up to have the contextify native module compile.) All of this places some rather annoying restrictions on integrating view pre-compilation into existing build chains. And actually; you can do a lot better than that. Loading CanJS on top of this fake DOM library worked just fine for me without having to rely on jsdom or similar. Infact; it meant I could write a RequireJS loader plugin and have the whole thing integrate directly with its optimizer build tool: it just loads the EJS file during development and compiles it in-browser, but it loads CanJS serverside and inlines a precompiled view definition into the optimized JS files in production builds. Really simple to use as well. E.g. // app/controls/MyControl.js
define([ "can", "ejs!../views/MyControl.ejs" ], function( can, viewId ) {
return can.Control.extend({
init : function() {
var me = this;
can.view( viewId, {}, function( frag ) { me.element.append( fragment ); });
}
});
}); Really; doesn't that feel a lot more flexible than fudging things with having to hook up additional grunt tasks? |
I think this is exactly what PR #3 addresses. The problem is providing the shimmed CanJS version (without having to modify it with every release). Any suggestions there or a pull request with your implementation would be really helpful because you are right, there is no need for a DOM when compiling the views - plus it would allow to finally finish the RequireJS view loader. |
This is closed by moving to can-simple-dom via #45 |
While such dependencies are fine if you can work with a global Node.js installation and a working npm install of jsdom (and crucially; contextify), it completely bombs when trying to integrate with existing build-chains.
This is a problem in particular for MSBuild-driven builds such as is the case with Visual Studio or TFS build server.
How hard would it be to use only the EJS compiler itself to produce the template and nothing else? (Or alternatively; how hard would it be to shim a minimal underlying DOM library on which to build up CanJS?)
The text was updated successfully, but these errors were encountered: