UNPKG

9.25 kBMarkdownView Raw
1<a name="ParticleHelpers"></a>
2
3## ParticleHelpers
4Particle Helpers load particles from their respective paths within the project.
5
6```
7- particles
8|-- conditions
9|-- helpers
10|-- mappings
11|-- metadata
12|-- outputs
13|-- parameters
14|-- partials
15|-- resources
16|-- sets
17```
18
19All helpers follow the same pattern
20
21`{{<CONDENSATION-HELPER> [module:<MODULE>] '<PATH_TO_PARTICLE>' [OPTIONS...]}}`
22
23When loading a particle from a module that starts with `particles-` the short form
24can also be used, where <M> is the name of the module without `particles-`
25
26`{{<CONDENSATION-HELPER> [m:<M>] '<PATH_TO_PARTICLE>' [OPTIONS...]}}`
27
28**Kind**: global namespace
29
30* [ParticleHelpers](#ParticleHelpers) : <code>object</code>
31 * [.condition([module], path, [...options])](#ParticleHelpers.condition) ⇒ <code>string</code>
32 * [.mapping([module], path, [...options])](#ParticleHelpers.mapping) ⇒ <code>string</code>
33 * [.metadata([module], path, [...options])](#ParticleHelpers.metadata) ⇒ <code>string</code>
34 * [.output([module], path, [...options])](#ParticleHelpers.output) ⇒ <code>string</code>
35 * [.parameter([module], path, [...options])](#ParticleHelpers.parameter) ⇒ <code>string</code>
36 * [.resource([module], path, [...options])](#ParticleHelpers.resource) ⇒ <code>string</code>
37 * [.helper([module], path, [...options])](#ParticleHelpers.helper) ⇒ <code>\*</code>
38 * [.partial([module], path, [...options])](#ParticleHelpers.partial) ⇒ <code>string</code>
39 * [.set([module], path, [options])](#ParticleHelpers.set) ⇒ <code>string</code>
40
41
42* * *
43
44<a name="ParticleHelpers.condition"></a>
45
46### condition([module], path, [...options])
47```
48- particles
49|- conditions
50 |- particle_name
51```
52
53**Kind**: static method of [<code>ParticleHelpers</code>](#ParticleHelpers)
54
55| Param | Type | Description |
56| --- | --- | --- |
57| [module] | <code>string</code> | module to load with either `module:<MODULE>` or `m:<M>` |
58| path | <code>string</code> | Path to the particle (file extensions optional) |
59| [...options] | <code>kv</code> | Key/Value pairs to pass to the particle |
60
61**Example**
62```js
63{{condition "particle_name"}}
64```
65**Example**
66```js
67{{condition "particle_name" foo="bar"}}
68```
69**Example**
70```js
71{{condition "module:<MODULE>" 'particle_name'}}
72```
73**Example**
74```js
75{{!-- to load modules with format `particles-NAME` --}}
76{{condition "m:<NAME>" "particle_name"}}
77```
78
79* * *
80
81<a name="ParticleHelpers.mapping"></a>
82
83### mapping([module], path, [...options])
84```
85- particles
86|- mappings
87 |- particle_name
88```
89
90**Kind**: static method of [<code>ParticleHelpers</code>](#ParticleHelpers)
91
92| Param | Type | Description |
93| --- | --- | --- |
94| [module] | <code>string</code> | module to load with either `module:<MODULE>` or `m:<M>` |
95| path | <code>string</code> | Path to the particle (file extensions optional) |
96| [...options] | <code>kv</code> | Key/Value pairs to pass to the particle |
97
98**Example**
99```js
100{{mapping "particle_name"}}
101```
102**Example**
103```js
104{{mapping "particle_name" foo="bar"}}
105```
106**Example**
107```js
108{{mapping "module:<MODULE>" 'particle_name'}}
109```
110**Example**
111```js
112{{!-- to load modules with format `particles-NAME` --}}
113{{mapping "m:<NAME>" "particle_name"}}
114```
115
116* * *
117
118<a name="ParticleHelpers.metadata"></a>
119
120### metadata([module], path, [...options])
121```
122- particles
123|- metadata
124 |- particle_name
125```
126
127**Kind**: static method of [<code>ParticleHelpers</code>](#ParticleHelpers)
128
129| Param | Type | Description |
130| --- | --- | --- |
131| [module] | <code>string</code> | module to load with either `module:<MODULE>` or `m:<M>` |
132| path | <code>string</code> | Path to the particle (file extensions optional) |
133| [...options] | <code>kv</code> | Key/Value pairs to pass to the particle |
134
135**Example**
136```js
137{{metadata "particle_name"}}
138```
139**Example**
140```js
141{{metadata "particle_name" foo="bar"}}
142```
143**Example**
144```js
145{{metadata "module:<MODULE>" 'particle_name'}}
146```
147**Example**
148```js
149{{!-- to load modules with format `particles-NAME` --}}
150{{metadata "m:<NAME>" "particle_name"}}
151```
152
153* * *
154
155<a name="ParticleHelpers.output"></a>
156
157### output([module], path, [...options])
158```
159- particles
160|- outputs
161 |- particle_name
162```
163
164**Kind**: static method of [<code>ParticleHelpers</code>](#ParticleHelpers)
165
166| Param | Type | Description |
167| --- | --- | --- |
168| [module] | <code>string</code> | module to load with either `module:<MODULE>` or `m:<M>` |
169| path | <code>string</code> | Path to the particle (file extensions optional) |
170| [...options] | <code>kv</code> | Key/Value pairs to pass to the particle |
171
172**Example**
173```js
174{{output "particle_name"}}
175```
176**Example**
177```js
178{{output "particle_name" foo="bar"}}
179```
180**Example**
181```js
182{{output "module:<MODULE>" 'particle_name'}}
183```
184**Example**
185```js
186{{!-- to load modules with format `particles-NAME` --}}
187{{output "m:<NAME>" "particle_name"}}
188```
189
190* * *
191
192<a name="ParticleHelpers.parameter"></a>
193
194### parameter([module], path, [...options])
195```
196- particles
197|- parameters
198 |- particle_name
199```
200
201**Kind**: static method of [<code>ParticleHelpers</code>](#ParticleHelpers)
202
203| Param | Type | Description |
204| --- | --- | --- |
205| [module] | <code>string</code> | module to load with either `module:<MODULE>` or `m:<M>` |
206| path | <code>string</code> | Path to the particle (file extensions optional) |
207| [...options] | <code>kv</code> | Key/Value pairs to pass to the particle |
208
209**Example**
210```js
211{{parameter "particle_name"}}
212```
213**Example**
214```js
215{{parameter "particle_name" foo="bar"}}
216```
217**Example**
218```js
219{{parameter "module:<MODULE>" 'particle_name'}}
220```
221**Example**
222```js
223{{!-- to load modules with format `particles-NAME` --}}
224{{parameter "m:<NAME>" "particle_name"}}
225```
226
227* * *
228
229<a name="ParticleHelpers.resource"></a>
230
231### resource([module], path, [...options])
232```
233- particles
234|- resources
235 |- particle_name
236```
237
238**Kind**: static method of [<code>ParticleHelpers</code>](#ParticleHelpers)
239
240| Param | Type | Description |
241| --- | --- | --- |
242| [module] | <code>string</code> | module to load with either `module:<MODULE>` or `m:<M>` |
243| path | <code>string</code> | Path to the particle (file extensions optional) |
244| [...options] | <code>kv</code> | Key/Value pairs to pass to the particle |
245
246**Example**
247```js
248{{resource "particle_name"}}
249```
250**Example**
251```js
252{{resource "particle_name" foo="bar"}}
253```
254**Example**
255```js
256{{resource "module:<MODULE>" 'particle_name'}}
257```
258**Example**
259```js
260{{!-- to load modules with format `particles-NAME` --}}
261{{resource "m:<NAME>" "particle_name"}}
262```
263
264* * *
265
266<a name="ParticleHelpers.helper"></a>
267
268### helper([module], path, [...options])
269```
270- particles
271|- helpers
272 |- particle_name
273```
274
275**Kind**: static method of [<code>ParticleHelpers</code>](#ParticleHelpers)
276**Returns**: <code>\*</code> - - The output from the particle helper
277
278| Param | Type | Description |
279| --- | --- | --- |
280| [module] | <code>string</code> | module to load with either `module:<MODULE>` or `m:<M>` |
281| path | <code>string</code> | Path to the helper, excluding the `.js` extension |
282| [...options] | <code>kv</code> | Key/Value pairs to pass to the particle helper |
283
284**Example**
285```js
286{{helper "particle_name"}}
287```
288**Example**
289```js
290{{helper "particle_name" foo="bar"}}
291```
292**Example**
293```js
294{{helper "module:<MODULE>" 'particle_name'}}
295```
296**Example**
297```js
298{{!-- to load modules with format `particles-NAME` --}}
299{{helper "m:<NAME>" "particle_name"}}
300```
301
302* * *
303
304<a name="ParticleHelpers.partial"></a>
305
306### partial([module], path, [...options])
307```
308- particles
309|- partials
310 |- particle_name
311```
312
313**Kind**: static method of [<code>ParticleHelpers</code>](#ParticleHelpers)
314
315| Param | Type | Description |
316| --- | --- | --- |
317| [module] | <code>string</code> | module to load with either `module:<MODULE>` or `m:<M>` |
318| path | <code>string</code> | Path to the partial (file extensions optional) |
319| [...options] | <code>kv</code> | Key/Value pairs to pass to the particle partial |
320
321**Example**
322```js
323{{partial "particle_name"}}
324```
325**Example**
326```js
327{{partial "particle_name" foo="bar"}}
328```
329**Example**
330```js
331{{partial "module:<MODULE>" 'particle_name'}}
332```
333**Example**
334```js
335{{!-- to load modules with format `particles-NAME` --}}
336{{partial "m:<NAME>" "particle_name"}}
337```
338
339* * *
340
341<a name="ParticleHelpers.set"></a>
342
343### set([module], path, [options])
344```
345- particles
346|- sets
347 |- particle_name
348```
349
350**Kind**: static method of [<code>ParticleHelpers</code>](#ParticleHelpers)
351
352| Param | Type | Description |
353| --- | --- | --- |
354| [module] | <code>string</code> | module to load with either `module:<MODULE>` or `m:<M>` |
355| path | <code>string</code> | Path to the set (file extensions optional) |
356| [options] | <code>Object</code> | options for the set |
357| [options.logicalIdPrefix] | <code>string</code> | Add a prefix to the set's scope |
358| [options.logicalIdSuffix] | <code>string</code> | Add a suffix to the set's scope |
359
360**Example**
361```js
362{{set "particle_name"}}
363```
364**Example**
365```js
366{{set "particle_name" foo="bar"}}
367```
368**Example**
369```js
370{{set "module:<MODULE>" 'particle_name'}}
371```
372**Example**
373```js
374{{!-- to load modules with format `particles-NAME` --}}
375{{set "m:<NAME>" "particle_name"}}
376```
377
378* * *
379