将Dojo构建集成到Grails构建中? [英] Integrate Dojo Build into Grails Build?

查看:203
本文介绍了将Dojo构建集成到Grails构建中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解了dojo的构建系统,但是我对Grails来说比较新。有没有人知道如何或有资源将dojo的JS构建集成到Grails中?我想在开发过程中可以使用JS源代码,然后切换到JS的内置版本进行生产。



到目前为止,我设想只有js dir中的dojo-src目录,并在开发过程中使用。然后,当我要部署到prod时,我将手动运行一个dojo构建并将其输出到/ js目录中。



(我打算给我们一个请求参数来告诉应用程序哪个js要使用,压缩或src)。



另外还有更好的方法我应该考虑一下吗?

解决方案

我不知道很多关于grails ,但我认为你是正确的道路。我使用查询参数设置要使用的配置,但是我将配置存储在会话中,这样我就不需要在每个页面上。



看看我的答案:
如何在Dojo 1.7中使用未压缩的文件?



从我在Grails中读到的内容,它使用ant构建。这是一个蚂蚁脚本来构建。我不知道如何将它整合到建立战争的gant公约中。

 < 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>


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?

解决方案

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>

这篇关于将Dojo构建集成到Grails构建中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆