upassist / prototypegenerator
一个原型生成器,可以快速根据nodetype定义生成原型。
README
这个包是做什么的?
这个包允许你使用命令行创建Neos原型的脚手架。
为什么创建这个?
在Neos中使用Atomic设置通常需要为单个NodeType创建很多文件。
包括Fusion文件、CSS文件,有时还需要特定的JS文件。
当使用PhpStorm中的textExpander或livetemplates等模板时,创建文件仍然需要一些时间。
现在不再是这样了!😃
⚙️ 如何安装
只需运行composer命令即可安装此包。
composer require upassist/prototypegenerator --dev
如何设置
🚀 快速设置
复制以下设置并设置默认值
UpAssist: PrototypeGenerator: # Set a default packageKey and you don't have to write the full `Vendor.Package` prefix every time (but you still can) (optional) packageKey: '' # Folder structure (in array format) leading to your package packageParentFolder: ['DistributionPackages'] # The rendering prototypes # For document, content and collection you can list the additional prototypes to render rendering: document: - template content: - organism - molecule - atom collection: - organism - molecule - atom # List of types you also want to create a CSS file renderCSS: [ 'template', 'organism', 'molecule', 'atom' ] # List of types you also want to create a JS file renderJS: [ 'organism' ] # The file extension used for rendering the CSS file (i.e. `css`, `scss`, `sass`, `less`) cssExtension: 'css' # The file extension used for rendering the JS file (i.e. `js`, `jsx`) jsExtension: 'js' # The name for your extendedRenderer (optional, but required in the default setup since the default templates use this) extendedRenderer: ''
👉🏻 高级设置
查看所有设置,您可以设置您想要如何渲染原型、更改继承等默认值。
📘 如何使用
您有一些可用的命令
💡 所有命令都支持 --force 参数,用于覆盖已创建的文件。
💡 您可以使用您的原型的完整名称,如果设置了设置中的packageKey,则可以省略它。(例如,Neos.NodeTypes:Content.Text变为Content.Text)
💡 值得了解的是
- 默认模板在生成的文件中添加了
@Todo(您可以在设置中修改此内容),允许您使用IDE查看您还需要实现什么,最好在完成后将其删除。 - 您可以使用sprintf语法修改默认模板以替换字符串;设置显示了您可以使用的内容。
- 您可以修改一个或多个模板。或者如果您喜欢默认设置,则可以不修改任何模板。
- 此工具考虑到原子融合的使用,但也可以在不使用该功能的情况下使用。
- 我提到生成器可以根据您的要求创建内容原型和所有原子部分了吗?😎
⚠️ 警告 #1
在此阶段,文档、ContentCollection或Content类型的确定是通过nodename进行的,这在即将推出的版本中将改为查看superType。现在使用此包意味着您必须将nodeType命名为如下
Vendor.Package:Document.PageVendor.Package:Content.TextVendor.Package:Collection.Section|Vendor.Package:ContentCollection.Section
🧠 考虑但尚未实现...
🤔 后续...
这真的不是为了准备好,可能需要更好的考虑。但是,对于我使用的设置来说,它相当不错,我很高兴使用这个工具节省了大量时间。我真的希望它能让你的Neos开发生活更轻松,当然欢迎pull requests 😊
感谢你读到这儿,如果你喜欢它,让我知道吧 🙂。
— Henjo