I have created a groovy DSL extending the class BuilderSupport
, and it looks like this right now:
def menu = new MenuBuilder().create {
item "something.label" : "something"
item "other.label" : "other"
item "asd.label": "asd", {
"test.label": "test"
}
}
where create
is not really a function, it's just a standard name for the root node,
and item "X": "Y"
represents a menu item where X is it's label and Y is the item's target controller.
The DSL is already working. My question is how can I make it so you can simply specify the DSL in a separate file and then load it when the Grails application is starting, similar to Grails's Bean's DSL and constraints's DSL.
The file would have only the following code inside it.
{
item "something.label" : "something"
item "other.label" : "other"
item "asd.label": "asd", {
"test.label": "test"
}
}
Thanks for your attention