svenkreiss / html5validator

Command line tool to validate HTML5 files. Great for continuous integration.
MIT License
314 stars 34 forks source link

Adding --remove-mustaches using pystache (new feature #23) #24

Closed Lucas-C closed 7 years ago

Lucas-C commented 7 years ago

What do you think of this idea ? :)

svenkreiss commented 7 years ago

This sounds like a preprocessor to convert mustache templates to HTML. Its an interesting idea, but I think this is outside of the scope of html5validator for now and too specific to mustache.

I could see adding a crawler. That would mean you could serve HTML (possibly generated from mustache templates) and validate the crawled HTML using html5validator.

On Mon, Jul 25, 2016 at 6:43 PM Lucas Cimon notifications@github.com wrote:

What do you think of this idea ? :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/svenkreiss/html5validator/pull/24#issuecomment-235108931, or mute the thread https://github.com/notifications/unsubscribe-auth/ACpYJptjJisnIdU3w2o6EyNuCyb5T1X1ks5qZTwVgaJpZM4JOiT2 .

Lucas-C commented 7 years ago

I don't get the crawler role here. What transformation would it perform on its input exactly ? And what kind of input would it take ?

But I understand your point about the separation of concerns & mustache templates beeing too specific.

There are many flavours of HTML templating systems. Just to name a few:

Certainly there is a need for extensibility here, and there is no reason to support only mustache templates.

However, I do not not really agree that this is clearly out of the scope of a Python lib / CLI HTML validator. It would be really handy for such tool to have "batteries included", and support the most common templating systems, so that one could easily validate its HTML templates without adding any extra layer. I definitely see that that as a "plus" in term of usability. I think adding "template plugins" could be the best option here. Mustache templates would be just a start, but they cover many cases in the list above (e.g. Angular & Handlebar share the same syntax with it).

Of course, you may not want your validator to take this direction. It's your call, and I can build another tool or fork html5validator to add this support for HTML templates.

Lucas-C commented 7 years ago

Any thoughts ?

svenkreiss commented 7 years ago

I was thinking more about something like localcrawl. This can crawl a local development server and it processes all the JavaScript with a headless browser. It outputs the generated HTML and works with any template engine. The readme contains an example with a small Mustache template.

Does that work for your use case?

Lucas-C commented 7 years ago

I worked around this by implementing mustaches-substitution in my pre-commit hook: https://github.com/Lucas-C/pre-commit-hooks-html

No, localcrawl does not really work the way I want.

Closing this