angular-gettext-tools
angular-gettext-tools copied to clipboard
Add Pug support
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?
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)
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 :smile: