Socket
Book a DemoInstallSign in
Socket

pug-ng-html-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pug-ng-html-loader

Pug to html loader for webpack, close to HTML and friendly with Angular 2

1.0.10
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Pug Angular 2 HTML loader for webpack

This enables using pug-plugin-ng through Webpack, see that repo for details. In short, this allows writing Pug as close to HTML as possible, making it terser and facilitating conversion between Pug and HTML. This is particularly desirable when using Angular 2, because its different non-standard uses of HTML attributes required workarounds polluting Pug with additional brackets/commas and =''.

Why not just use pug-html-loader?

Because you cannot pass pug-plugin-ng into its options; Webpack query JSON serialization kills functions, see here.

Installation

npm i --saveDev pug-ng-html-loader

Usage

myComp.pug:

.items(
  *ngFor="#item of items"
  [ngClass]="{'active': isActive}"
)
  p {{item}}

myComp.ts:

@Component({
  template: require('./myComp.pug'),
})

In your webpack.config.js file, using pug-ng-html-loader:

module.exports = {
  // your config settings ...
  module: [
    //your modules...
    loaders: [
      { test: /\.pug$/, loader: 'pug-ng-html' },
    ]
  ]
};

License

MIT (http://www.opensource.org/licenses/mit-license.php)

Keywords

webpack

FAQs

Package last updated on 23 Sep 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.