liquify 1.3.0

SDKdartflutter
Platformandroidioswindowslinuxmacos

A powerful and extensible Liquid template engine for Dart. Supports full Liquid syntax, custom tags and filters, and high-performance parsing and rendering.

Examples

This directory contains comprehensive examples demonstrating various features and capabilities of the Liquid Grammar library.

Quick Start Examples

Basic Usage

  • Template rendering fundamentals
  • Variable interpolation
  • Filters and data transformation
  • Custom filters and tags

Template Layouts

  • Layout inheritance patterns
  • Block definitions and overrides
  • Multi-level template hierarchies
  • Dynamic layout selection

File System Integration

  • Template loading from files
  • Template inclusion and rendering
  • File system abstraction
  • Error handling for missing files

Advanced Examples

Custom Tags

  • Creating custom tag implementations
  • Parser integration patterns
  • Complex tag logic with multiple blocks
  • Tag registration and usage

Drop Objects

  • Custom object model integration
  • Property access patterns
  • Method invocation from templates
  • Nested object hierarchies

Example Categories

CategoryDescriptionExamples
BasicFundamental template operationsVariable output, loops, conditionals
FiltersData transformation examplesCustom filters, filter chaining
TagsControl flow and custom logicCustom tags, block tags
LayoutsTemplate inheritanceLayout systems, block overrides
ObjectsCustom data modelsDrop classes, property access
FilesFile system integrationTemplate loading, includes

Running Examples

All examples are self-contained Dart programs that can be run directly:

# Run basic example
dart run example/example.dart

# Run layout example
dart run example/layout.dart

# Run custom tag example
dart run example/custom_tag.dart

# Run drop objects example
dart run example/drop.dart

# Run file system example
dart run example/fs.dart

Example Output

Each example produces formatted output demonstrating the specific features:

  • Template rendering results - Showing the final generated content
  • Feature demonstrations - Highlighting specific functionality
  • Error handling - Showing graceful failure modes
  • Performance patterns - Efficient usage examples

Contributing Examples

When adding new examples:

  1. Create self-contained, runnable examples
  2. Include comprehensive comments
  3. Demonstrate both basic and advanced usage
  4. Show error handling patterns
  5. Provide expected output in comments