自定义 Grails 创建应用程序
我希望我的 Grails 应用程序具有与标准 Grails 应用程序不同的外观和感觉。由于我不想修改每个应用程序,因此我想自定义项目创建 (grails create-app
)
在谷歌搜索一番后,我发现可以直接在 GRAILS_HOME 中修改模板目录。 (http://grails.1312388.n4.nabble.com/create-app-customization-td1351040.html)
所以我修改了 GRAILS_HOME/src/grails/grails-app/views/main.gsp
和 GRAILS_HOME/src/war/css/main.css ,但创建新的 grails 应用程序时没有任何变化。我通过 ./gradlew assemble
重建了整个 GRAILS_HOME 项目,没有任何改变。我错过了什么? GRAILS_HOME/dist/grails-resources-1.3.7.jar
中的 jar 文件包含更新的文件。
I want my Grails Apps to have a different Look&Feel than the standard Grails one. As I didn't want to modify every single application, I would like to customize the project creation (grails create-app
)
After googling a bit around I found the possibility to modify the templates directly in the GRAILS_HOME directory. (http://grails.1312388.n4.nabble.com/create-app-customization-td1351040.html)
So I modified GRAILS_HOME/src/grails/grails-app/views/main.gsp
and GRAILS_HOME/src/war/css/main.css
but nothing changed when creating a new grails app. I rebuild the whole GRAILS_HOME project via ./gradlew assemble
nothing changed. What have I missed?
The jar file at GRAILS_HOME/dist/grails-resources-1.3.7.jar
contains the updated files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好通过实现您自己的 grails 插件来实现,该插件将在安装后替换所有必需的文件(
main.gsp
、main.css
)。This is better to do by implementing your own plugin for grails, that will replace all required files (
main.gsp
,main.css
) after installing.我们遇到了同样的问题,当我们执行 create-app 时,没有看到 grails 目录中更改的文件。我们意识到我们真正想要的是一种通过我们的定制快速创建应用程序的方法。并不是说我们需要 grails 来创建该应用程序。我们的解决方案是创建一个具有所需自定义的框架应用程序并打包应用程序目录。当我们想要创建一个新应用程序时,
现在我们有了一个具有所需结构的应用程序。这不是最优雅的方法。但它有效! ;)
We came across the same issue where files changed in the grails directory were not seen when we did a create-app. We came to the realization that what we really wanted was a way to quickly create an application with our customizations. Not that we need grails to create that app. Our solution was to create a skeleton application with the desired customizations and jar up the application directory. When we want to create a new app,
And now we have an application with the desired structure. Not the most elegant approach. But it works! ;)