Integrate Dojo Build into Grails Build?

偶尔善良 提交于 2019-12-11 20:06:32

问题


I understand dojo's build system, but I'm rather new to Grails. Does anyone know how, or have a resource for, integrating dojo's JS build into Grails? I'd like to be able to use the JS sources during development, and then switch to the built version of JS for production.

So far, I am envisioning just having the dojo-src directory in js dir, and using that during development. Then, when I want to deploy to prod, I'll manually run a dojo build and output it also in the /js dir.

(I'm planning to us a request parameter to tell the app which js to use, compressed or src).

Is there another, better, way I should consider?


回答1:


I don't know a whole lot about grails, but I think you are on the right path. I use a query parameter to set the configuration to use, but i store the configuration in the session, so that I don't need it on every page.

Take a look at my answer to this: How do I use uncompressed files in Dojo 1.7?

From what I have read on Grails, it uses ant for building. This is an ant script to build. I don't know how to integrate it into the gant convention for building a war.

<java fork="true" dir="${dojo.build.util.dir}/buildscripts"
classname="org.mozilla.javascript.tools.shell.Main">

<classpath>
    <pathelement location="${dojo.build.util.dir}/shrinksafe/js.jar"/>
    <pathelement location="${dojo.build.util.dir}/shrinksafe/shrinksafe.jar"/>
</classpath>

<arg value="build.js"/>
<arg value="version=${version}"/>
<arg value="profileFile=../../profile.js"/>
<arg value="action=release"/>
<arg value="releaseDir=../../../"/>
<arg value="releaseName=${dojo.releaseName}" />
<arg value="optimize=shrinksafe"/>
<arg value="cssOptimize=comments.keepLines"/>
</java>


来源:https://stackoverflow.com/questions/11092237/integrate-dojo-build-into-grails-build

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