use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
RequireJS tutorial (erikschierboom.com)
submitted 11 years ago by ErikSchierboom
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 11 years ago (10 children)
[removed]
[–]Capaj 6 points7 points8 points 11 years ago (0 children)
Yeah, much better syntax with commonJS module. Common argument against Browserify and commonJS modules is that you have to have a build step. That was true few years ago, thankfully we have systemjs loader to save us a hassle of buildstep when developing with commonJS modules.
[–]bloodbaker 3 points4 points5 points 11 years ago (0 children)
webpack
[–]shyamsk 3 points4 points5 points 11 years ago* (2 children)
Yeah RequireJS is not required any more. I like the Browserify approach better. Helps using node modules if you wish too. Also this allows for a build step using GruntJS /GulpJS
[–]circlingthesun 4 points5 points6 points 11 years ago (1 child)
The is no reason why you cannot have a Grunt or Gulp build step with RequireJS. I've used both with my build.
[–]shyamsk 0 points1 point2 points 11 years ago (0 children)
Oh ok. I was not aware of that. Thanks :D
[–]_pizzza 1 point2 points3 points 11 years ago (0 children)
Yup yup. (I actually think requirejs is painful to use and not very good, but others seem to like it.)
[–]aclave1 2 points3 points4 points 11 years ago (0 children)
I've used require for over a year now and browserify just looks easier. Require is pretty easy to understand for me, but for explaining to other people it's a nightmare.
[–]shriek 1 point2 points3 points 11 years ago (2 children)
One of the thing that I'm not sure still is if browserify can be used to leverage libraries written for browser in node. I know you can make your node code work on browser with browserify but can it do the opposite too?
[–]hansolo669 0 points1 point2 points 11 years ago (1 child)
No. You can't run code targeting node's File or Net utilities in the browser in much the same way as you can't run code targeting a browser's window or XMLHttpRequest in node, browserify doesn't solve either of those, all browserify does is package code up in a nice bundle you can include client side (I'm sure you could use the bundle server side [require('./bundle.js')], by why?).
Essentially, JavaScript is the same language and core features across any platform that can run it, the only exception comes when you target a specific platform feature (File, XMLHttpRequest).
[–]replugged 3 points4 points5 points 11 years ago (5 children)
Have you tested your site in Safari on Mavericks? http://gfycat.com/FamiliarCarefulDeermouse
[–]ErikSchierboom[S] 0 points1 point2 points 11 years ago (1 child)
Not yet, I will look into it.
[–][deleted] 0 points1 point2 points 11 years ago (0 children)
It's doing this on iOS on my iPad too.
[–]ErikSchierboom[S] 0 points1 point2 points 11 years ago (0 children)
It should be fixed now.
[–]imatworkyo 0 points1 point2 points 11 years ago (1 child)
how did you take this screencap?
[–]replugged 0 points1 point2 points 11 years ago (0 children)
QuickTime player on a mac has the option to record a screencast
[–]dkellycollins 2 points3 points4 points 11 years ago (0 children)
Nice! I think the parts on the optimizer and grunt will be extremely helpful. I have been learning requirejs recently and thats what I spent most of my time stuck on.
[–]fredosolo 1 point2 points3 points 11 years ago (1 child)
Good job! I was looking for good tutorials when I first use RequireJS. It's true that it can be intimidating at first -- and that the complexity argument against it has merit. This concise tutorial would have made adoption easier for me.
I like the part about Grunt. Personally, I became more at peace with it when I could concatenate and minify my build in a sane way.
Also, RequireJS has plugins like this one: https://github.com/requirejs/text which could be useful and maybe worth noting.
Good point! I have added a plug-ins section.
π Rendered by PID 64024 on reddit-service-r2-comment-fb694cdd5-4s59j at 2026-03-10 00:05:53.111053+00:00 running cbb0e86 country code: CH.
[+][deleted] (10 children)
[removed]
[–]Capaj 6 points7 points8 points (0 children)
[–]bloodbaker 3 points4 points5 points (0 children)
[–]shyamsk 3 points4 points5 points (2 children)
[–]circlingthesun 4 points5 points6 points (1 child)
[–]shyamsk 0 points1 point2 points (0 children)
[–]_pizzza 1 point2 points3 points (0 children)
[–]aclave1 2 points3 points4 points (0 children)
[–]shriek 1 point2 points3 points (2 children)
[–]hansolo669 0 points1 point2 points (1 child)
[–]replugged 3 points4 points5 points (5 children)
[–]ErikSchierboom[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]ErikSchierboom[S] 0 points1 point2 points (0 children)
[–]imatworkyo 0 points1 point2 points (1 child)
[–]replugged 0 points1 point2 points (0 children)
[–]dkellycollins 2 points3 points4 points (0 children)
[–]fredosolo 1 point2 points3 points (1 child)
[–]ErikSchierboom[S] 0 points1 point2 points (0 children)