Twig.js
twig.js, flexible, secure, and high-performance templating engine for Javascript
Install / Use
/learn @schmittjoh/Twig.jsREADME
Twig.js
[
] Build Status
[
] Scrutinizer Code Quality
Twig.js is a PHP project that compiles Twig templates into executable Javascript for client-side execution. It is not to be confused with Twig.js, which is a pure Javascript implementation of the Twig templating language.
Twig Compatibility
Compatibility with vanilla PHP Twig is not yet at 100%. If you need your templates to work with both Twig.js and Twig, stick to the supported filters and functions described below.
Supported Filters
absbatchcapitalizedefaulteescapefirstjoinjson_encodekeyslastlengthlowermergenl2brrawreplacereversetitletrimupperurl_encode
Supported Functions
blockincludemaxminrandomrange
Incompatibilities
The following is a list of functionality present in Twig that is not yet available in Twig.js. There are some really easy pickings in these lists for anybody hoping to make a contribution to the project.
Unsupported Filters
convert_encodingdate(See pull request #11)date_modifyformatnumber_formatroundslicesortsplitstriptags
Unsupported Functions
attributeconstantcycledate(See pull request #11)dumpparentsourcetemplate_from_string
Testing
To run the tests, you'll need Composer, Node and NPM on your system.
$ make test
License
Twig.js is released under the Apache License, Version 2.0.
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
