-
Notifications
You must be signed in to change notification settings - Fork 312
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 Rendr work with requirejs #190
Conversation
@@ -7,5 +7,9 @@ examples/*/node_modules | |||
examples/**/compiledTemplates.js | |||
examples/*/public/mergedAssets.js | |||
examples/*/public/styles.css | |||
examples/*/public/mergedAssets.js |
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.
This line is duped from above
@@ -0,0 +1,20 @@ | |||
require( |
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.
should this file be removed?
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.
we need to preload globals before everything and routes too,
handlebars require in the compliledTemplates.
In general I really like the approach. It's good to make more of these methods async (BaseView, Fetcher). Like I said, I don't have the chance to spin through it right now locally because of a deadline but LMK if I'm blocking you on anything. One note: it would be awesome if these changes could conform to the existing style of the codebase. We try to follow the style guide published here: https://github.com/airbnb/javascript. Mainly i'm thinking of having curly braces on the same line rather than on its own line (PHP-style). Good: if (foo) {
bar();
} else {
baz(function() {
console.log('baz');
});
} Bad: if (foo)
{
bar();
}
else
{
baz(function()
{
console.log('baz');
});
} |
Sure, I fix styling. It's just helps me to read code, usually I go and clean up after, but when it's middle of the night, I might miss some chunks. :) For I'm focusing on other stuff too, Let me know what I can do to speed things up. Thank you. |
keeping it by default, but adding ways to disable it. Useful for Oauth, which doesn't like JSON requests. PS. We need it now, but I'll clean it up and make as separate PR, when we will be merging RequireJS one.
{ | ||
// TODO: Make it function (err, View) | ||
if (!_.isFunction(View)) { | ||
throw new Error("View '" + key + "' not found."); |
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.
Probably should pass this error as first arg to callback
rather than throwing.
I'm having some trouble running 05_requirejs example locally. Getting this error in js console:
and indeed,
|
Cool. Looks good. There's some cleanup we can do, but let's just get this merged and move forward from there! Thanks a lot @alexindigo @jskulski @bigethan for all your help. Would you like to try squashing these commits first? If not, not a blocker. |
Sure, thank you for your support. |
Made Rendr work with requirejs
Oh... I just squished everything together :) Too slow. #fail :) |
Lol, sorry! I was too eager! |
It's actually good. Keeps me on my toes :) You know – survival of the fittest :) |
Ah shoot, ran into an error with
|
The path is weird for the command: |
yes, it's a bug in requires (they said it's not, but rather feature) I'm yet to add workaround for that, I mean I have workaround there as part of grunt options, but going to add into requirejs itself. Can you show me your grunt options file or is it the one from 05_requirejs? |
It's straight from master. |
Hmm, one sec then. |
I ran into this just today. You need to add |
It comes from getAppViewClass() referencing the client libs in rendr/shared/app.js |
I think I added it. And I had to remove and recheckout my |
Oh and tests, seems like I forgot something somewhere. Sorry. |
Thanks a lot @muhleder! That does it. Fixed in 34d2563. There may be some other things we need to fix due to divergence from master during this PR's long incubation period. For example, I see a reference to We've since deprecated |
You know, actually, I think i might just remove the |
I'll port changes from |
I think it's good to have more features to showcase in requires version, or maybe to have two examples, very simple one and something more sophisticated. |
How about you'd update 00 – 04 the way you think would be more example-friendly and then I'll port `00`` and something else to requirejs. |
Deal, sounds good. |
@alexindigo any plans to release grunt-rendr-requirejs as an NPM module? |
Yes, I wanted incorporate that workaround into it, but probably better "ship it early fix it later". :) |
Done. https://npmjs.org/package/grunt-rendr-requirejs |
Cool! It's a start. Added to 05_requirejs's package.json here: ec6632f |
Thanx. Btw, there is PR for grunt-rendr-stitch, tests were failing. Or stitch is thing of the past now? |
Oh and |
@spikebrehm This PR adds RequireJs support to Rendr and example app
05_requirejs
that contains grunt file and modified app files.In order to make it run, you need to augment Rendr files to work on frontend by running
grunt init
(as you suggested no extra boilerplate in original Rendr files on the server).When it's done you can continue as usual with
grunt server
.This example works with unminified/uncombined app/rendr files as a proof of the concept (and probably dev env workflow), for the production files can be minified combined into one or few different files using grunt + r.js minification tool.
Please let me know if you have any questions/concerns. Thank you.
/cc @bigethan @jskulski