npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@myndpm/pug2html

v2.0.6

Published

CLI utility to convert `pug` content to `html`. Also converts inline `template` metadata and rename `.pug` extension to `.html`

Downloads

21

Readme

@myndpm/pug2html

CLI utility to convert pug content to html.
Also converts inline template metadata and rename .pug extension to .html

Usage

npx @myndpm/pug2html [--path <path>] [--git] [--dry-run]
  [--diagnose]
  [--convert]
  [--move]
  [--prettify]
  • --path <path> - Path to the directory for conversion. Default is current directory
  • --git Convert and move files keeping the GIT history
  • --dry-run Do not execute and just print the steps
  • --diagnose Only list and detect line endings on the existing stylesheets in the directory
  • --convert Only convert the pug contents to html
  • --move Only move the pug files to HTML and update the related TS files
  • --prettify Only prettify the converted files

Examples

Only diagnose the given path listing the files to process:

npx @myndpm/pug2html --path relative/path/ --diagnose [--git]

Only runs the pug conversion step:

npx @myndpm/pug2html --convert

Only move the files and update the components:

npx @myndpm/pug2html --move

Only prettify the existing html files:

npx @myndpm/pug2html --prettify

Prints the files and commands that will be executed:

npx @myndpm/pug2html --dry-run [--git]

Perform all the conversion steps on the current folder and commits to git:

npx @myndpm/pug2html --git

Troubleshooting

  • Before you commit each step you can review the staged files in your IDE.
  • Search on a whole repo let-, $implicit, ngForOf. Check how it was used in the .pug file and revert if there are any differences.
  • There might be issues with whitespaces since pug preprocess whitespaces and remove all of them. The only way to fix those - is to run build/unit tests/e2e-s. Most likely there will be no issues or impact will be minor.
  • Search for pug inside your repo and remove any related code - builders, packages, scripts, etc.

Known issues

There is a known issue with $implicit. Search your codebase for $implicit and check how let- were converted.

ng-template([ngTemplateOutlet]="tmpl", [ngTemplateOutletContext]="{ $implicit: elem }")
ng-template(#tmpl, let-elem)

will be converted to

<ng-template [ngTemplateOutlet]="tmpl" [ngTemplateOutletContext]="{ $implicit: elem }"></ng-template>
<ng-template #tmpl let-elem="elem"></ng-template>
<!-- but it should be -->
<ng-template [ngTemplateOutlet]="tmpl" [ngTemplateOutletContext]="{ $implicit: elem }"></ng-template>
<ng-template #tmpl let-elem></ng-template>

let-elem="elem" => let-elem

Another known issue is with NgForOf. Search your codebase for ngForOf and check how let- were converted.

ng-template(ngFor let-row [ngForOf]="rows" let-i="index")
  li ...

will be converted to

<ng-template ngFor let-row="let-row" [ngForOf]="rows" let-i="index">
  <li>...</li>
</ng-template>
<!-- but it should be -->
<ng-template ngFor let-row [ngForOf]="rows" let-i="index">
  <li>...</li>
</ng-template>

let-row="row" => let-row