Question:
I have a script that generates typescript classes from a source descriptor. Those classes are used by the angular project.
However, I have to manually run the script when the descriptor changes.
Is it possible to hook some event in angular cli, so the script can be called before an ng build or ng serve, for example?
Ideally the descriptor should be watched during the ng serve, and the callback invoked whenever it changes, such as what happens with SASS -> CSS.
@angular/cli: 1.0.0
node: 7.7.3
os: linux x64
I have a project that does something similar. You can use npm scripts in your package.json
"start": "pretasks && ng serve"
Then run npm run start
This will run the prebuild task before running the project. As for runtime build hooks I am unsure.
Thanks @coryrylan, this is a nice workaround.
I've been researching on this and found the issue https://github.com/angular/angular-cli/issues/1656 which, if done, could allow writing a webpack plugin for watching resources on runtime and emitting additional files.
But, as it seems, direct access to the webpack configuration won't be allowed (unless the project is ng ejected, which is not ideal either, because we loose some benefits of angular-cli).
Maybe in the future it will be possible to write angular-cli plugins, let's see.
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._
Most helpful comment
Thanks @coryrylan, this is a nice workaround.
I've been researching on this and found the issue https://github.com/angular/angular-cli/issues/1656 which, if done, could allow writing a webpack plugin for watching resources on runtime and emitting additional files.
But, as it seems, direct access to the webpack configuration won't be allowed (unless the project is
ng ejected, which is not ideal either, because we loose some benefits of angular-cli).Maybe in the future it will be possible to write angular-cli plugins, let's see.