templating icon indicating copy to clipboard operation
templating copied to clipboard

Update documentation with YAML/YML extensions support content

Open crhairr opened this issue 7 years ago • 5 comments

The comment syntax for yaml/yml files is not supported, but should be treated as identical to "Language Constructs" listed in the wiki. YAML comments start with a #, and would work identically with the preprocessor syntax.

crhairr avatar Jul 09 '19 20:07 crhairr

I was having the same problem and ended up trying to setup a specialCustomOperation for **/*.yml files based on the runnable targets wiki article.

I couldn't get it to work by setting up the if/else/else if configuration based on that, but there's another open issue 1641 which shows a different solution;

template.json:

  "SpecialCustomOperations": {
    "**/*.yml" : {
      "Operations": [
        {
          "type": "conditional",
          "configuration": {
            "style": "line",
            "token": "#"
          }
        }
      ]
    }
  }

sample.yml

thing:
  - thing1
  - thing2
##if( condition )
  - thing3
##endif
  - thing4

It's working for me. All credit goes to @williamdenton.

pholden77 avatar Jul 29 '19 02:07 pholden77

Awesome! I'll give this a shot.

It would still be nice if Yaml was supported our of the box given its overseeing increasing prevalence in the software world. Especially vis-a-vis Docker.

crhairr avatar Jul 29 '19 11:07 crhairr

You can do the following for yaml:

//#if (condition)
somestuff
//#endif

Might be nice to add this to the docs, especially useful for yaml pipelines.

spinspume avatar Mar 09 '20 12:03 spinspume

@grinrag , let's update the docs with the above.

donJoseLuis avatar Mar 20 '20 07:03 donJoseLuis

Added example above to wiki page.

vlada-shubina avatar Sep 09 '20 13:09 vlada-shubina