Giter Club home page Giter Club logo

ng-template-urlify's Introduction

Angular Template URLify

Replace all your component inline template properties with templateUrl and generate the respective HTML files automatically.

Before

// app.component.ts

@Component({
  selector: 'app-root',
  template: `
    <h1>Tour of Heroes</h1>
    <p>Lorem ipsum</p>
  `,
})
export class AppComponent {}

After

// app.component.ts

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
})
export class AppComponent {}
<!-- app.component.html -->

<h1>Tour of Heroes</h1>
<p>Lorem ipsum</p>

Usage

Firstly, make sure you are using some version control system like Git or you have a backup of your project. This will overwrite your existing TS files.

Once you've done that, run:

npx ng-template-urlify /path/to/your/files

or

npm install -g ng-template-urlify
ng-template-urlify /path/to/your/files

Rationale

Say you have a huge project with lots of components and have been using inline templates since the beginning. For any reason (performance on VSCode is one of them โ€“ HTML templates perform much better than inline ones), you want to change all your components to have separate HTML files instead of inline properties.

This will come in handy โ€“ with one command you can transform all your components to have separate HTML files. Otherwise you would have to do it manually.

License

Apache 2.0

ng-template-urlify's People

Contributors

juniormendes96 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.