-
Notifications
You must be signed in to change notification settings - Fork 31
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
Made RequireJS friendly. #5
Conversation
@@ -20,7 +25,8 @@ exports.templatePatterns = templateFinder.templatePatterns; | |||
* `getLayout` should only be used on the server. | |||
*/ | |||
if (typeof window === 'undefined') { | |||
exports.getLayout = require('./server/layoutFinder')(Handlebars).getLayout; | |||
var serverOnlyPath_layoutFinder = './server/layoutFinder'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So r.js
wouldn't go down that route, it ignores require with variables.
I'm open to supporting RequireJS, but a little wary about having to add this boilerplate to every file in Rendr. Yikes! Perhaps we can follow the example of some leading projects like Handlebars and actually just use ES6 modules, which can be transpiled to CommonJS & RequireJS (see this PR: handlebars-lang/handlebars.js#628). Thoughts on that? It's initially more work, but ultimately more satisfying :) |
I absolutely agree, boilerplates suck.
So it does make sense from some angles of view. |
It will require compilation step for both server and browser, For me it's not big of a problem to make client bound files make look more like browser based js, Maybe if remove that scary comment wrappers and make normal indentation it would look more organic I really want to escape compilation step for each change, I think it's the main fun killer, |
Hey, I've got idea for the middleground. :) Since rendr doesn't really change for the app I'll have grunt script copying whatever needed to the But we still need to keep changes server-only require statements. What do you think? |
Wrapped into
amdefine
and "hid" require of server only file.