Skip to content

How can I use pug in @angular/cli #6085

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

Closed
baihech opened this issue Apr 26, 2017 · 7 comments
Closed

How can I use pug in @angular/cli #6085

baihech opened this issue Apr 26, 2017 · 7 comments

Comments

@delasteve
Copy link
Contributor

See comment: #1886 (comment)

We currently do not support pug in the CLI. This will be most likely added in 2.0 via a plug-in system. To add pug to your project, you will need to do customization to the build process yourself. It's possible to use ng eject, but I am going to warn you, there is no going back from the eject command. From there, your best bet is to ask StackOverflow after as we don't support ejected applications.

My suggestion? Don't use pug.

@sumitarora
Copy link
Contributor

Closing as above.

@svallory
Copy link

svallory commented Jul 28, 2017

EDIT: Don't use this. My project is over and I'm not maintaing it.

@baihech I made a pull request to allow tweaking webpack config with a file in the project root. For now, you can use the cli at https://github.com/cashfarm/angular-advanced-cli (branch 1.2.x)

Install pug, pug-ng-html-loader and add a webpack.config.js with this to root of your project:

module.exports = {
  module: {
    rules: [
      {
        test: /\.(pug|jade)$/,
        use: ['pug-ng-html-loader']
      }
    ]
  }
}

Then your components can use pug

@Component({
  selector: 'app-root',
  templateUrl: './app.component.pug',
  styleUrls: ['./app.component.styl']
})

But your index has to stay in html.

@zhekaus
Copy link

zhekaus commented Nov 21, 2017

@delasteve , Can't see any problem with going back after ejecting. They always can restore package.json and .angular-cli.json and use ng serve as before.

@zhekaus
Copy link

zhekaus commented Nov 21, 2017

@svallory , however you sacrifice aot

@superjose
Copy link

Just in case someone came lurking here for answers. If you're using Angular CLI 6, you can now:

ng add ng-cli-pug-loader

Got it from here.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants