2017 © Pedro Peláez
 

neos-package simpletemplate

This simple template automatically resolves file paths according to the Neos best practises.

image

codeq/simpletemplate

This simple template automatically resolves file paths according to the Neos best practises.

  • Wednesday, June 20, 2018
  • by rolandschuetz
  • Repository
  • 2 Watchers
  • 0 Stars
  • 87 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 26 % Grown

The README.md

Neos - Simple Template for Fluid template path mapping

You never need to manually define a template path to your Fluid file anymore. The simple template automatically sets up folder paths based on the Neos best practises., (*1)

Usage

  1. Install with composer require codeq/unicodenormalizer, (*2)

  2. Your node types will automatically use the new template, examples of the auto mapping can be found below., (*3)

  3. To use auto mapping in your Fusion components, the prototype needs to be baed on the SimplteTempalte, (*4)

    prototype(Example.Site:Component.Footer) < prototype(CodeQ.SimpleTemplate:Template) {
      ...
    }
    

Best practises for folder and file naming

NodeTypes

  1. Each NodeType configuration has it’s own file: Configuration/NodeTypes.<Document/Content>.<NodeType Name>.yaml, (*5)

  2. Each NodeType has it’s own folder for rendering with:, (*6)

    Resources/Private/Fusion/<Document/Content>/<NodeType Name>/
       <NodeType Name>.fusion 
       <NodeType Name>.html (optional)
    
  3. The Fusion prototype name is Example.Site:<Document/Content>.<NodeType Name>

Sub-NodeTypes

Some NodeTypes are only allowed inside other NodeTypes, e.g. a SliderItem is always a subnode of a Slider. To better group them you can use the following folder structure:, (*7)

  1. Each Sub-NodeType configuration has it’s own file: Configuration/NodeTypes.<Document/Content>.<NodeType Name>.<Sub-NodeType Name>.yaml, (*8)

  2. Each Sub-NodeType has it’s own folder for rendering with:, (*9)

    Resources/Private/Fusion/<Document/Content>/<NodeType Name>/<Sub-NodeType Name>/
       <Sub-NodeType Name>.fusion
       <Sub-NodeType Name>.html (optional)
    
  3. The Fusion prototype name is Example.Site:<Document/Content>.<NodeType Name>.<Sub-NodeType Name>, (*10)

Standalone Fusion Components

Components are reusable Fusion (and Fluid) modules which can be reused when rendering different NodeTypes. A component consists of one Fusion and an optional Fluid file., (*11)

  1. Each component has its own folder inside the Components folder with: Resources/Private/Fusion/Components/<Component Name>/ <Component Name>.fusion <Component Name>.html (optional)
  2. Each Fluid component must inherit from prototype(Example.Site:SimpleTemplate), (*12)

  3. The Fusion prototype name is Example.Site:Component.<Component Name>, (*13)

The main idea behind all of it is this:

The location of all files related to a Fusion object (Fusion protype, Fluid template) should always be deducible from object's name name. E.g., (*14)

Example.Site:Content.Slider   -> ../Private/Fusion/Content/Slider/Slider.fusion
                              -> ../Private/Fusion/Content/Slider/Slider.html
Example.Site:Component.Footer -> ../Private/Fusion/Component/Footer/Footer.fusion
                              -> ../Private/Fusion/Component/Footer/Footer.html

Certain prototypes should provide reusable functionality and therefore only named Components. Those should not bound to a particular NodeType., (*15)

If you need to break apart one big Fusion prototype into a few smaller ones, you can always group them with another layer of namespacing, e.g.:, (*16)

Example.Site:Content.News                 -> ../Private/Fusion/Content/News/News.fusion
Example.Site:Content.News.RelatedArticles -> ../Private/Fusion/Content/News/RelatedArticles/RelatedArticles.fusion

The Versions

20/06 2018

dev-master

9999999-dev

This simple template automatically resolves file paths according to the Neos best practises.

  Sources   Download

MIT GPL-3.0+

The Requires

 

flow neos fluid

20/06 2018

v1.0.1

1.0.1.0

This simple template automatically resolves file paths according to the Neos best practises.

  Sources   Download

MIT

The Requires

 

flow neos fluid

13/01 2018

v1.0.0

1.0.0.0

This simple template automatically resolves file paths according to the Neos best practises.

  Sources   Download

GPL-3.0+

The Requires