You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Detail performance test reports can be found <ahref="https://github.com/zordius/HandlebarsTest">here</a>, go http://zordius.github.io/HandlebarsTest/ to see charts.
20
17
***SMALL!** all PHP files in 189K
21
18
***ROBUST!**
22
-
* 100% supports <ahref="https://github.com/mustache/spec">mustache spec v1.1.3</a>. For the optional lambda module, supports 4 of 10 specs.
23
19
* Supports almost all <ahref="https://github.com/jbboehr/handlebars-spec">handlebars.js spec</a>
24
20
* Output <ahref="https://github.com/zordius/HandlebarsTest/blob/master/FEATURES.md">SAME</a> with <ahref="https://github.com/wycats/handlebars.js">handlebars.js</a>
25
-
***FLEXIBLE!**
26
-
* Lot of <ahref="#compile-options">options</a> to change features and behaviors.
27
21
* Context generation
28
22
* Analyze used features from your template (execute `LightnCandy::getContext()` to get it) .
29
23
* Debug
@@ -332,46 +326,11 @@ function ($in) {
332
326
333
327
Please make sure the passed in `renderex` is valid PHP, LightnCandy will not check it.
334
328
335
-
Customize Rendering Runtime Class
336
-
---------------------------------
337
-
338
-
If you want to extend `LightnCandy\Runtime` class and replace the default runtime library, you may use `runtime` when `compile()` . For example, this sample will generate render function based on your extended `MyRunTime`:
Please make sure `MyRunTime` exists when compile().
355
-
356
329
Unsupported Feature
357
330
-------------------
358
331
359
332
*`{{foo/bar}}` style variable name, it is deprecated in official handlebars.js document, please use this style: `{{foo.bar}}`.
360
333
361
-
Suggested Handlebars Template Practices
362
-
---------------------------------------
363
-
364
-
* Prevent to use `{{#with}}` . I think `{{path.to.val}}` is more readable then `{{#with path.to}}{{val}}{{/with}}`; when using `{{#with}}` you will confusing on scope changing. `{{#with}}` only save you very little time when you access many variables under same path, but cost you a lot time when you need to understand then maintain a template.
365
-
* use `{{{val}}}` when you do not require HTML escaped output on the value. It is better performance, too.
366
-
* Prevent to use custom helper if you want to reuse your template in different language. Or, you may need to implement different versions of helper in different languages.
367
-
* For best performance, you should only use 'compile on demand' pattern when you are in development stage. Before you go to production, you can `LightnCandy::compile()` on all your templates, save all generated PHP codes, and deploy these generated files (You may need to maintain a build process for this) . **DO NOT COMPILE ON PRODUCTION** , it also a best practice for security. Adding cache for 'compile on demand' is not the best solution. If you want to build some library or framework based on LightnCandy, think about this scenario.
368
-
* Recompile your templates when you upgrade LightnCandy every time.
369
-
* Persistant ESCAPING practice of `{` or `}` for both handlebars and lightncandy:
370
-
* If you want to display atomic `}}` , you can just use it without any trick. EX: `{{foo}} }}`
371
-
* If you want to display `}` just after any handlebars token, you can use this: `{{#with "}"}}{{.}}{{/with}}` . EX: `{{foo}}{{#with "}"}}{{.}}{{/with}}`
372
-
* If you want to display atomic `{` , you can just use it without any trick. EX: `{ and {{foo}}`.
373
-
* If you want to display `{{` , you can use `{{#with "{{"}}{{.}}{{/with}}`. EX: `{{#with "{{"}}{{.}}{{/with}}{{foo}}`
374
-
375
334
Detail Feature list
376
335
-------------------
377
336
@@ -450,22 +409,3 @@ Go http://handlebarsjs.com/ to see more feature description about handlebars.js.
450
409
*`{{#> @partial-block}}` : access partial block content inside a partial
451
410
*`{{#*inline "partial_name"}}...{{/inline}}` : Inline partial, provide a partial and overwrite the original one.
452
411
*`{{log foo}}` : output value to stderr for debug.
453
-
454
-
Developer Notes
455
-
---------------
456
-
457
-
Please read <ahref=".github/CONTRIBUTING.md">CONTRIBUTING.md</a> for development environment setup.
0 commit comments