Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

RequireJS Section Tweaking #393

Merged
merged 1 commit into from

2 participants

@jackfranklin

I added a note to the build config bit about the fact that you have to use .js when specifying the output. When I first got started with RequireJS I always forgot it and it tripped me up so I figured a quick sentence about it would be nice.

Also got some queries:

L649: var app_view = .... Any reason why it's app_view and not appView ?

In the build config section, is it worth talking about the mainConfigFile option? I use it a lot to avoid duplication across my config & my build files (https://github.com/jrburke/r.js/blob/master/build/example.build.js#L35).

@addyosmani
Owner

Thanks for the addition, @jackfranklin!

The reason for the difference in variable casing/naming is sometimes due to different authors helping us with specific parts of the book or codebase. As you can imagine we occasionally have to clean up their choices to keep them consistent across the book - would you like to make the app_view -> appView change?

On mainConfigFile - definitely! If you think you might have some time to write up a note about that too we would happily merge it in.

@addyosmani addyosmani merged commit 2c0ff2a into addyosmani:gh-pages
@jackfranklin

@addyosmani I was going to propose going through all the Code in C8 and changing it to all be in the same style as right now it's pretty different as you say. Is there a preferred style? I'm happy to go through it.

I'll also get something on mainConfigFile written up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 31, 2013
  1. @jackfranklin
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 chapters/08-modular-development.md
View
6 chapters/08-modular-development.md
@@ -479,7 +479,7 @@ define(['jquery', 'backbone', 'underscore'].concat(models),
will be ignored. This is by design as it ensures that dynamic dependency/module loading can still take place even after optimization.
-Although the RequireJS optimizer works fine in both Node and Java environments, it's strongly recommended to run it under Node as it executes significantly faster there.
+Although the RequireJS optimizer works fine in both Node and Java environments, it's strongly recommended to run it under Node as it executes significantly faster there.
To get started with r.js, grab it from the [RequireJS download page](http://requirejs.org/docs/download.html#rjs) or [through NPM](http://requirejs.org/docs/optimization.html#download). To begin getting our project to build with r.js, we will need to create a new build profile.
@@ -491,7 +491,7 @@ Assuming the code for our application and external dependencies are in `app/libs
out: 'dist/main.js',
```
-The paths above are relative to the `baseUrl` for our project and in our case it would make sense to make this the `app` folder. The `out` parameter informs r.js that we want to concatenate everything into a single file.
+The paths above are relative to the `baseUrl` for our project and in our case it would make sense to make this the `app` folder. The `out` parameter informs r.js that we want to concatenate everything into a single file, that should be called `main.js` and be created within the `dist/` directory. Note that here, we do need to add the `.js` extension to the filename. Earlier we saw that when referencing modules by filenames, you don't need to use the `.js` extension, however this is one case in which you do.
Alternatively, we can specify `dir`, which will ensure the contents of our `app` directory are copied into this directory. e.g:
@@ -1440,4 +1440,4 @@ Paginator.clientPager = Backbone.Collection.extend({
[4]: http://addyosmani.github.com/backbone.paginator/examples/netflix-client-paging/index.html
[5]: http://addyosmani.github.com/backbone.paginator/examples/netflix-infinite-paging/index.html
[6]: http://github.com/addyosmani/backbone.paginator/issues
- [7]: https://github.com/cowboy/grunt
+ [7]: https://github.com/cowboy/grunt
Something went wrong with that request. Please try again.