mix elementorex.gen.block (ElementorexCms v0.1.0)

Copy Markdown View Source

Generates a block for the visual editor, with props for the inspector, its render function and a test.

$ mix elementorex.gen.block Pricing
$ mix elementorex.gen.block Marketing.HeroBanner --category layout --container --icon sparkles

Creates lib/my_app_web/blocks/pricing.ex (module MyAppWeb.Blocks.Pricing) and test/my_app_web/blocks/pricing_test.exs. Register it afterwards:

config :elementorex_cms, blocks: [MyAppWeb.Blocks.Pricing]

Options

  • --type - type stored in documents (default: the snake_case name)
  • --label - name in the palette (default: from the module name)
  • --icon - Heroicons name for the palette (default square-3-stack-3d)
  • --category - layout, basic, components, media, advanced or your own (default components)
  • --container - the block holds child blocks
  • --namespace - module namespace (default MyAppWeb.Blocks)
  • --no-test - skip the test
  • --force - overwrite existing files