Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

io-ng2-aot-fixer-pug

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

io-ng2-aot-fixer-pug

A small tool to generate typescript files from .pug template files. Useful for ng2 devlopment

  • 0.1.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Angular AOT Fixer : PUG

This package tries to fix the ng2 AOT compiler behaviour that expect the template of a @Component to be a string.

ngc works fine if the template metadata is defined for a @Component but when you want to use .pug files for your templates it fails.

import { tpl } from "./this-component.pug";

@Component({
  template: tpl
})

This would fail since typescript has no knowledge of how to handle pug files:

❯ node_modules/.bin/ngc -p .
TypeError: this._input.charCodeAt is not a function
    at _Tokenizer._advance (/Users/me/dev/angular-2-seed/node_modules/@angular/compiler/bundles/compiler.umd.js:4980:73)
    at new _Tokenizer (/Users/me/dev/angular-2-seed/node_modules/@angular/compiler/bundles/compiler.umd.js:4864:16)

This package generates a .ts file for every pug file present that will contain the pure HTML as parsed by pug. It must be run before doing a ngc build. The compiler will then be able to resolve the .pug import as a string (The content is exposed as a export named tpl!)

In the above example a file called ./this-component.pug.ts will be generated. You may safely add *.pug.ts files to your .gitignore since you'll only need them for the AOT compiler run.

Usage:

node_modules/.bin/ng2-aot-fixer-pug --src-path src

FAQs

Package last updated on 21 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc