posthtml / posthtml-cli

CLI for PostHTML
MIT License
29 stars 18 forks source link

posthtml options #306

Closed Scrum closed 4 years ago

Scrum commented 4 years ago

Hi @Scrum. Thank you very much. This does work.

Could you please tell me how could I achieve the same functionality but with plugins in the config file (.posthtmlrc)?

Originally posted by @VladimirMikulic in https://github.com/posthtml/posthtml/issues/329#issuecomment-673316646

Scrum commented 4 years ago

@VladimirMikulic Unfortunately, this functionality is not available, I made it a separate task and soon I will implement it

Scrum commented 4 years ago

@VladimirMikulic publish v0.7.1

VladimirMikulic commented 4 years ago

@Scrum fixed in a snap! Wow! I appreciate that very much.

I tried it now, but it seems that it is not picking up the config file.

.posthtmlrc

{
  "directives": [
    {
      "name": "?",
      "start": "<",
      "end": ">"
    },
    {
      "name": "?=",
      "start": "<",
      "end": ">"
    }
  ]
}

Command: posthtml -c .posthtmlrc index.html -o dist/index-a.html (It's still that same index.html file from #329)

Scrum commented 4 years ago
{
  input: 'test/fixtures/by-config/options/input.html',
  output: 'test/expected/by-config/options/output.html',
  options: {
    directives: [{name: '?php', start: '<', end: '>'}]
  }
}