简体   繁体   中英

Ember CLI “Blueprint” for Creating an Addon

I have been wanting to create Ember addons that adhere to my company's structure and have some pre-formatted files.

For instance, I would like...

  • The addon spacing to default to 4 spaces instead of 2.
  • The package.json file to contain certain default packages when created.
  • I would like to add some new files to the addon when it is first created.

My understanding is that blueprints must live inside an addon/application and therefore there is no way to modify what the addon structure looks like at the time it is generated. Is it possible to do these types of things through the concept of a "blueprint"? Or would I need to fork Ember CLI and modify the internals? I dislike the idea of forking Ember CLI since I would need to manually keep it up to date.

Thanks in advance!

You can definitely use custom blueprints when generating a brand new project. glimmerjs uses this with success. You can use this repo as a guideline https://github.com/glimmerjs/glimmer-blueprint , then generate your new project via

ember new my-addon -b https://github.com/my-company/my-companys-blueprint.git

That blueprint source can be a git repo url, or npm package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM