Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pug support #169

Open
simon04 opened this issue May 15, 2017 · 2 comments
Open

Add Pug support #169

simon04 opened this issue May 15, 2017 · 2 comments

Comments

@simon04
Copy link

simon04 commented May 15, 2017

I like to write my templates in the Pug format (instead of HTML). It would be great if angular-gettext-tools supported extracting strings from PUG files.

Concerning the implementation, this should be as easy as invoking pug.compileFile on the Pug file and proceeding with the resulting HTML code as normal.

What do you think?

@rubenv
Copy link
Owner

rubenv commented May 15, 2017

I'd rather not add support for each and every markup language out there (our NPM dependency tree would become enormous).

Given that you'll probably compile to HTML somewhere to be able to serve the markup up in the browser, I'd recommend parsing that HTML.

(we're Pug/Jade users ourselves at Ticketmatic and that's exactly what we do)

@simon04
Copy link
Author

simon04 commented May 15, 2017

Thanks for your answer. I agree that one cannot support every possible markup language. Have you considered a plugin interface for adding custom parsers?

Concerning the package dependency: when adding pug as a peerDependency, it isn't pulled automatically when installing the package.

I try to make angular-gettext-tools work together with webpack using @wombleton's https://github.com/wombleton/angular-gettext-extract-loader after transforming Pug to HTML using a custom loader. The problem is that although the Pug is converted to HTML, it still has the .pug file extension (as is default for webpack loaders). Thus, the gettext extractor silently does nothing on those files. Passing the extensions: {pug: 'html'} option works finally.

Having Pug supported and the pug dependency listed via peerDependency would greatly simplify the usage 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants