Loading...
Loading...
Deep knowledge for creating and modifying Handlebars templates (.hbs files). Trigger: When user needs to create/modify .hbs templates, add helpers, work with template syntax, or understand Handlebars patterns.
npx skill4agent add neversight/skills_feed handlebars.hbssrc/@cliter/utils/template-engine.tshandlebarshandlebars-helperssrc/@cliter/handlebars/helpers/src/@cliter/handlebars/partials/src/templates/handlebars-helpers// src/@cliter/handlebars/helpers/my-helper.ts
import * as handlebars from 'handlebars';
handlebars.registerHelper('myHelper', function(param1: string, param2: any, options)
{
// options.data.root contains all template data
// options.fn(this) executes block content
// options.inverse(this) executes else block
return result;
});// src/@cliter/handlebars/partials/my-partial.ts
import * as handlebars from 'handlebars';
handlebars.registerPartial('myPartial', `
{{#each items}}
{{ this.name }}
{{/each}}
`);
content if true
content if false
- - -
content if false
content if equal
content if not equal
| Helper | Description | Example |
|---|---|---|
| Convert to camelCase | |
| Convert to PascalCase | |
| Convert to kebab-case | |
| Convert to snake_case | |
| Concatenate strings | |
| Remove line breaks | |
has items
is undefined
not in array
schema.aggregateProperties
:
handlebars-helpers
is string
found
is array
has 5
at
both truthy
at least one truthy
falsey
equal
loosely equal
not equal
greater than
greater or equal
less than
less or equal
comparison
found
matches
even
odd
every 2nd
truthy
falsey
both falsey
not equal
not greater
not less
has key
is object
:
:
empty
matches
Full Reference: See references/handlebars-helpers-reference.md for complete documentation.
Need string transformation? → toCamelCase, toPascalCase, toKebabCase, toSnakeCase (Aurora)
→ camelcase, pascalcase, snakecase, dashcase (handlebars-helpers)
Need to store temporary data? → setVar
Need to build arrays/objects? → array, object, push
Need conditional rendering? → if, unless, eq, unlessEq, ternary, and, or, not, compare
Need to iterate? → each, loops, forEach, eachIndex, forIn, forOwn
Need to filter properties? → get*Properties helpers (Aurora custom)
Need to manage imports? → importManager with importsArray
Need unique IDs? → uuid, nanoid
Need math operations? → add, subtract, multiply, divide, ceil, floor, round
Need string manipulation? → trim, split, replace, truncate, append, prepend
Need array operations? → first, last, sort, unique, filter, map, join
Need object access? → get, hasOwn, forIn, forOwn
Need URL handling? → encodeURI, decodeURI, urlParse, stripQuerystring
Need path operations? → basename, dirname, extname, resolve// src/@cliter/handlebars/helpers/is-required-property.ts
import * as handlebars from 'handlebars';
import { Property } from '../../types';
handlebars.registerHelper('isRequiredProperty', function(
property: Property,
)
{
return !property.nullable && !property.hasOwnProperty('defaultValue');
});
export interface Input
{
?: ;
}
// Handle enum type
// Handle other types
# Build after adding helpers
yarn build
# Find all helpers
ls src/@cliter/handlebars/helpers/
# Find helper usage in templates
grep -r "helperName" src/templates/
# Test template rendering
yarn test~
content
content
../
src/@cliter/handlebars/helpers/index.ts{{{{{