Skip to content

[pug-code-gen] Rewrite using babel #2708

@jeromew

Description

@jeromew

From @ForbesLindesay on November 6, 2015 10:1

babel does a really good job of generating source maps. Generating ASTs will also help us only generate proper, syntactically valid javascript. As a bonus we can rapidly run any babel plugins we want on the output for optimisation or implementation of advanced features.

One of the restrictions this will impose is that unbuffered code blocks (e.g. - var x = 10;) will now need to be valid statements. This forces people to use our built in constructs for if, else, each etc. I don't think that's a bad thing though, and we can make up for it with much better error messages for syntax errors.

I think this is too big a feature to block the 2.0.0 release, which I really want to roll out this weekend. I do think we should hold off on plugins for code-gen until this is complete though.

Copied from original issue: pugjs/pug-code-gen#21

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions