Skip to content

Commit dd5142f

Browse files
committed
fixing code highlighting
1 parent c79d906 commit dd5142f

File tree

61 files changed

+367
-367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+367
-367
lines changed

guides/v3.1.0/addons-and-dependencies/managing-dependencies.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The globals provided by some assets (like `moment` in the below example) can be
3333
without the need to `import` them.
3434
Provide the asset path as the first and only argument.
3535

36-
```ember-cli-build.js
36+
```javascript {data-filename=ember-cli-build.js}
3737
app.import('node_modules/moment/moment.js');
3838
```
3939

@@ -44,7 +44,7 @@ about using an undefined variable.
4444

4545
You can transform an anonymous AMD module to a named one by using the `amd` transformation.
4646

47-
```ember-cli-build.js
47+
```javascript {data-filename=ember-cli-build.js}
4848
app.import('node_modules/moment/moment.js', {
4949
using: [
5050
{ transformation: 'amd', as: 'moment' }
@@ -64,7 +64,7 @@ with `require` for you automatically. It is not yet included with ember-cli by d
6464
ember install ember-cli-cjs-transform
6565
```
6666

67-
```ember-cli-build.js
67+
```javascript {data-filename=ember-cli-build.js}
6868
app.import('node_modules/showdown/dist/showdown.js', {
6969
using: [
7070
{ transformation: 'cjs', as: 'showdown' }
@@ -79,7 +79,7 @@ You can now `import` them in your app. (e.g. `import showdown from 'showdown';`)
7979
If you need to use different assets in different environments, specify an object as the first parameter.
8080
That object's key should be the environment name, and the value should be the asset to use in that environment.
8181

82-
```ember-cli-build.js
82+
```javascript {data-filename=ember-cli-build.js}
8383
app.import({
8484
development: 'node_modules/moment/moment.js',
8585
production: 'node_modules/moment/min/moment.min.js'
@@ -90,7 +90,7 @@ If you need to import an asset in only one environment you can wrap `app.import`
9090
For assets needed during testing, you should also use the `{type: 'test'}` option to make sure they
9191
are available in test mode.
9292

93-
```ember-cli-build.js
93+
```javascript {data-filename=ember-cli-build.js}
9494
if (app.env === 'development') {
9595
// Only import when in development mode
9696
app.import('vendor/ember-renderspeed/ember-renderspeed.js');
@@ -106,7 +106,7 @@ if (app.env === 'test') {
106106

107107
Provide the asset path as the first argument:
108108

109-
```ember-cli-build.js
109+
```javascript {data-filename=ember-cli-build.js}
110110
app.import('node_modules/foundation/css/foundation.css');
111111
```
112112

@@ -124,7 +124,7 @@ Third-party assets that are not added via `import()` will not be present in the
124124

125125
By default, `import`ed assets will be copied to `dist/` as they are, with the existing directory structure maintained.
126126

127-
```ember-cli-build.js
127+
```javascript {data-filename=ember-cli-build.js}
128128
app.import('node_modules/font-awesome/fonts/fontawesome-webfont.ttf');
129129
```
130130

@@ -133,7 +133,7 @@ This example would create the font file in `dist/font-awesome/fonts/fontawesome-
133133
You can also optionally tell `import()` to place the file at a different path.
134134
The following example will copy the file to `dist/assets/fontawesome-webfont.ttf`.
135135

136-
```ember-cli-build.js
136+
```javascript {data-filename=ember-cli-build.js}
137137
app.import('node_modules/font-awesome/fonts/fontawesome-webfont.ttf', {
138138
destDir: 'assets'
139139
});
@@ -143,7 +143,7 @@ If you need to load certain dependencies before others,
143143
you can set the `prepend` property equal to `true` on the second argument of `import()`.
144144
This will prepend the dependency to the vendor file instead of appending it, which is the default behavior.
145145

146-
```ember-cli-build.js
146+
```javascript {data-filename=ember-cli-build.js}
147147
app.import('node_modules/es5-shim/es5-shim.js', {
148148
type: 'vendor',
149149
prepend: true

guides/v3.1.0/applications/dependency-injection.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ or application instance initializers (with the former being much more common).
3535

3636
For example, an application initializer could register a `Logger` factory with the key `logger:main`:
3737

38-
```app/initializers/logger.js
38+
```javascript {data-filename=app/initializers/logger.js}
3939
import EmberObject from '@ember/object';
4040

4141
export function initialize(application) {
@@ -63,7 +63,7 @@ use the `instantiate: false` option to avoid attempts to re-instantiate it durin
6363
In the following example, the `logger` is a plain JavaScript object that should
6464
be returned "as is" when it's looked up:
6565

66-
```app/initializers/logger.js
66+
```javascript {data-filename=app/initializers/logger.js}
6767
export function initialize(application) {
6868
let logger = {
6969
log(m) {
@@ -91,7 +91,7 @@ register your factories as non-singletons using the `singleton: false` option.
9191

9292
In the following example, the `Message` class is registered as a non-singleton:
9393

94-
```app/initializers/notification.js
94+
```javascript {data-filename=app/initializers/notification.js}
9595
import EmberObject from '@ember/object';
9696

9797
export function initialize(application) {
@@ -114,7 +114,7 @@ Once a factory is registered, it can be "injected" where it is needed.
114114

115115
Factories can be injected into whole "types" of factories with *type injections*. For example:
116116

117-
```app/initializers/logger.js
117+
```javascript {data-filename=app/initializers/logger.js}
118118
import EmberObject from '@ember/object';
119119

120120
export function initialize(application) {
@@ -140,7 +140,7 @@ The value of `logger` will come from the factory named `logger:main`.
140140

141141
Routes in this example application can now access the injected logger:
142142

143-
```app/routes/index.js
143+
```javascript {data-filename=app/routes/index.js}
144144
import Route from '@ember/routing/route';
145145

146146
export default Route.extend({
@@ -170,7 +170,7 @@ and services (via `import { inject } from '@ember/service';`).
170170

171171
The following code injects the `shopping-cart` service on the `cart-contents` component as the property `cart`:
172172

173-
```app/components/cart-contents.js
173+
```javascript {data-filename=app/components/cart-contents.js}
174174
import Component from '@ember/component';
175175
import { inject as service } from '@ember/service';
176176

@@ -182,7 +182,7 @@ export default Component.extend({
182182
If you'd like to inject a service with the same name as the property,
183183
simply leave off the service name (the dasherized version of the name will be used):
184184

185-
```app/components/cart-contents.js
185+
```javascript {data-filename=app/components/cart-contents.js}
186186
import Component from '@ember/component';
187187
import { inject as service } from '@ember/service';
188188

@@ -210,7 +210,7 @@ instance.
210210
Instance initializers receive an application instance as an argument, providing
211211
an opportunity to look up an instance of a registered factory.
212212

213-
```app/instance-initializers/logger.js
213+
```javascript {data-filename=app/instance-initializers/logger.js}
214214
export function initialize(applicationInstance) {
215215
let logger = applicationInstance.lookup('logger:main');
216216

@@ -233,7 +233,7 @@ instance at runtime.
233233
For example, this component plays songs with different audio services based
234234
on a song's `audioType`.
235235

236-
```app/components/play-audio.js
236+
```javascript {data-filename=app/components/play-audio.js}
237237
import Component from '@ember/component';
238238
import { computed } from '@ember/object';
239239
import { getOwner } from '@ember/application';

guides/v3.1.0/applications/initializers.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ember generate initializer shopping-cart
2828

2929
Let's customize the `shopping-cart` initializer to inject a `cart` property into all the routes in your application:
3030

31-
```app/initializers/shopping-cart.js
31+
```javascript {data-filename=app/initializers/shopping-cart.js}
3232
export function initialize(application) {
3333
application.inject('route', 'cart', 'service:shopping-cart');
3434
};
@@ -48,7 +48,7 @@ ember generate instance-initializer logger
4848

4949
Let's add some simple logging to indicate that the instance has booted:
5050

51-
```app/instance-initializers/logger.js
51+
```javascript {data-filename=app/instance-initializers/logger.js}
5252
export function initialize(applicationInstance) {
5353
let logger = applicationInstance.lookup('logger:main');
5454
logger.log('Hello from the instance initializer!');
@@ -63,7 +63,7 @@ export default {
6363

6464
If you'd like to control the order in which initializers run, you can use the `before` and/or `after` options:
6565

66-
```app/initializers/config-reader.js
66+
```javascript {data-filename=app/initializers/config-reader.js}
6767
export function initialize(application) {
6868
// ... your code ...
6969
};
@@ -74,7 +74,7 @@ export default {
7474
};
7575
```
7676

77-
```app/initializers/websocket-init.js
77+
```javascript {data-filename=app/initializers/websocket-init.js}
7878
export function initialize(application) {
7979
// ... your code ...
8080
};
@@ -85,7 +85,7 @@ export default {
8585
};
8686
```
8787

88-
```app/initializers/asset-init.js
88+
```javascript {data-filename=app/initializers/asset-init.js}
8989
export function initialize(application) {
9090
// ... your code ...
9191
};
@@ -103,7 +103,7 @@ Application initializers will always run before application instance initializer
103103

104104
By default initializer names are derived from their module name. This initializer will be given the name `logger`:
105105

106-
```app/instance-initializers/logger.js
106+
```javascript {data-filename=app/instance-initializers/logger.js}
107107
export function initialize(applicationInstance) {
108108
let logger = applicationInstance.lookup('logger:main');
109109
logger.log('Hello from the instance initializer!');
@@ -114,7 +114,7 @@ export default { initialize };
114114

115115
If you want to change the name you can simply rename the file, but if needed you can also specify the name explicitly:
116116

117-
```app/instance-initializers/logger.js
117+
```javascript {data-filename=app/instance-initializers/logger.js}
118118
export function initialize(applicationInstance) {
119119
let logger = applicationInstance.lookup('logger:main');
120120
logger.log('Hello from the instance initializer!');

guides/v3.1.0/applications/services.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ember generate service shopping-cart
2222

2323
Services must extend the [`Service`](https://www.emberjs.com/api/ember/release/modules/@ember%2Fservice) base class:
2424

25-
```app/services/shopping-cart.js
25+
```javascript {data-filename=app/services/shopping-cart.js}
2626
import Service from '@ember/service';
2727

2828
export default Service.extend({
@@ -32,7 +32,7 @@ export default Service.extend({
3232
Like any Ember object, a service is initialized and can have properties and methods of its own.
3333
Below, the shopping cart service manages an items array that represents the items currently in the shopping cart.
3434

35-
```app/services/shopping-cart.js
35+
```javascript {data-filename=app/services/shopping-cart.js}
3636
import Service from '@ember/service';
3737

3838
export default Service.extend({
@@ -66,7 +66,7 @@ You can either invoke it with no arguments, or you can pass it the registered na
6666
When no arguments are passed, the service is loaded based on the name of the variable key.
6767
You can load the shopping cart service with no arguments like below.
6868

69-
```app/components/cart-contents.js
69+
```javascript {data-filename=app/components/cart-contents.js}
7070
import Component from '@ember/component';
7171
import { inject as service } from '@ember/service';
7272

@@ -78,7 +78,7 @@ export default Component.extend({
7878

7979
Another way to inject a service is to provide the name of the service as the argument.
8080

81-
```app/components/cart-contents.js
81+
```javascript {data-filename=app/components/cart-contents.js}
8282
import Component from '@ember/component';
8383
import { inject as service } from '@ember/service';
8484

@@ -94,7 +94,7 @@ Sometimes a service may or may not exist, like when an initializer conditionally
9494
Since normal injection will throw an error if the service doesn't exist,
9595
you must look up the service using Ember's [`getOwner`](https://emberjs.com/api/ember/release/classes/@ember%2Fapplication/methods/getOwner?anchor=getOwner) instead.
9696

97-
```app/components/cart-contents.js
97+
```javascript {data-filename=app/components/cart-contents.js}
9898
import Component from '@ember/component';
9999
import { computed } from '@ember/object';
100100
import { getOwner } from '@ember/application';
@@ -115,7 +115,7 @@ Once loaded, a service will persist until the application exits.
115115
Below we add a remove action to the `cart-contents` component.
116116
Notice that below we access the `cart` service with a call to`this.get`.
117117

118-
```app/components/cart-contents.js
118+
```javascript {data-filename=app/components/cart-contents.js}
119119
import Component from '@ember/component';
120120
import { inject as service } from '@ember/service';
121121

@@ -132,7 +132,7 @@ export default Component.extend({
132132
Once injected into a component, a service can also be used in the template.
133133
Note `cart` being used below to get data from the cart.
134134

135-
```app/templates/components/cart-contents.hbs
135+
```handlebars {data-filename=app/templates/components/cart-contents.hbs}
136136
<ul>
137137
{{#each cart.items as |item|}}
138138
<li>

guides/v3.1.0/components/block-params.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ but they can also return output to be used in a block expression.
33

44
### Return values from a component with `yield`
55

6-
```app/templates/index.hbs
6+
```handlebars {data-filename=app/templates/index.hbs}
77
{{blog-post post=model}}
88
```
99

10-
```app/templates/components/blog-post.hbs
10+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
1111
{{yield post.title post.body post.author}}
1212
```
1313

@@ -23,7 +23,7 @@ This allows for template customization when using a component,
2323
where the markup is provided by the consuming template,
2424
but any event handling behavior implemented in the component is retained such as `click()` handlers.
2525

26-
```app/templates/index.hbs
26+
```handlebars {data-filename=app/templates/index.hbs}
2727
{{#blog-post post=model as |title body author|}}
2828
<h2>{{title}}</h2>
2929
<p class="author">by {{author}}</p>
@@ -38,7 +38,7 @@ The names are bound in the order that they are passed to `yield` in the componen
3838
It is possible to support both block and non-block usage of a component from a single component template
3939
using the `has-block` helper.
4040

41-
```app/templates/components/blog-post.hbs
41+
```handlebars {data-filename=app/templates/components/blog-post.hbs}
4242
{{#if (has-block)}}
4343
{{yield post.title post.body post.author}}
4444
{{else}}

0 commit comments

Comments
 (0)