Reputation: 21688
We are now open sourcing our project and as the open source requirement each file in the project need to contain license comment in top of the file.
Once the user downloaded the code they can add more component, directive, pipes, etc in to the project. We want, when the user will run any ng
command inside the project directory, the new created component, directive or pile will also generated with the license comment at the top of the file.
for example where a component generated it have the below code format
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-restaurant',
templateUrl: './restaurant.component.html',
styleUrls: ['./restaurant.component.scss']
})
export class RestaurantComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
I want it to be like this.
/*
* Copyright 2017 shepherd contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-restaurant',
templateUrl: './restaurant.component.html',
styleUrls: ['./restaurant.component.scss']
})
export class RestaurantComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
Is there a way we can achieve in current angular cli?
Upvotes: 0
Views: 851
Reputation: 60518
The ability to have custom templates was just added and is now available in beta: https://github.com/angular/angular-cli/issues/2377#issuecomment-325910253
However, there are currently no docs so it may be a bit trial and error until the docs are available.
Upvotes: 2