Custom Project Type Templates

可紊 提交于 2019-12-09 14:20:17

问题


When you create a new project in webstorm, you are given the option to create a new directory structure prepopulated with files: libraries, stylesheets, etc. for patterns like HTM5 boilerplate, Twitter boilerplate, etc. How does one create their own template for this? Is importing dummy projects the hack for it?


回答1:


I suggest not using templates. I find it far more easy and maintainable to create "empty" projects (from existing projects, of course) in a git repo (bitbucket, github, ...), clone one, and start from there.

The .idea should be in the repo, but .idea/workspace.xml should be ignored, as per the documentation.

This gives you the opportunity to gradually refine your template, and share it easily with a team.




回答2:


Use the LivePlugin plugin to create a project template:

<projectTemplate projectType="foo" templatePath="resources/bar.zip" category="true"/>

Use the Velocity Template Language (VTL) to create a file template:

File and code templates are written in the Velocity Template Language (VTL). So they may include:

Fixed text (markup, code, comments, etc.). 

In a file based on a template, the fixed text is used literally, as-is.

File template variables. 

When creating a file, the variables are replaced with their values. #parse directives to include other templates defined in the Includes tab on the File and Code Templates page of the Settings dialog box.

Other VTL constructs.

References

  • Create project template extensions using "user defined" templates
  • Creation of Extension to applicationConfigurable
  • IdeaPlugin.xml
  • PlatformExtensionPoints.xml
  • LivePlugin: Plugin for writing IDE plugins
  • Webstorm Help: File and Code Templates
  • Configuring JetBrains WebStorm for UI5 development
  • Webstorm Project and IDE Settings
  • Idea NodeJS Plugin
  • Apache Velocity Engine VTL Reference


来源:https://stackoverflow.com/questions/17257425/custom-project-type-templates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!