English 中文(简体)
资源来源: 将所有内容列入名录?
原标题:Resources Plugin -- How To include all contents in a directory?

我有一只铁路机,包含一系列封顶的名录中所有单束手提文件。 我想通过资源来管理这些资源,但不想明确登记。

<>

webapp
  app
    controller
      controller1.js
      controller2.js
      ...
    model
      model1.js
      ...
    view
      view1.js

在我的<代码>AppResources.groovy档案中宣布:

http://www.un.org/Depts/DGACM/index_french.htm

但这只是一劳永逸。 我尝试:

<代码>resource url: app/** 但无uck

我认为,我会把一些法典放在会合档案中,然后通过目录结构进行更新,但似乎没有发挥作用。 我在此试图:

def iterClos = {
        it.eachDir( iterClos );
        it.eachFile {
            resource url: ${it.canonicalPath};

        }

    }

    iterClos( new File("$grails.app.context/app") )

不幸的是,这也失败了。

是否有任何想法,我如何能够做到这一点?

最佳回答

问题已经解决。

顺便提一下,通过我的javascript台进行校正的想法是行之有效的。 我的守则是不正确的。 这里是动态装着我的javascript文档的法典:

--------------------------

import org.codehaus.groovy.grails.web.context.ServletContextHolder as SCH

modules = {
    core {
        resource url:  /resources/css/app.css , disposition:  head 
        resource url:  /resources/css/myapp.css , disposition:  head 
        resource url:  /extjs/ext-all-debug.js , dispostion:  head 

        getFilesForPath( /app ).each {
          resource url: it
        }
    }
}

def getFilesForPath(path) {

    def webFileCachePaths = []

    def servletContext = SCH.getServletContext()

    //context isn t present when testing in integration mode. -jg
    if(!servletContext) return webFileCachePaths

    def realPath = servletContext.getRealPath( / )

    def appDir = new File("$realPath/$path")

    appDir.eachFileRecurse {File file ->
        if (file.isDirectory() || file.isHidden()) return
        webFileCachePaths << file.path.replace(realPath,   )
    }

    webFileCachePaths
}

以上所述将使得资源gin本能够追踪我的javascript文档。 这里,当资源处于瘫痪状态时,html认为:

<script src="/myapp/extjs/ext-all-debug.js?_debugResources=y&n=1336614540164" type="text/javascript" ></script>
<script src="/myapp/app/controller/LogController.js?_debugResources=y&n=1336614540164" type="text/javascript" ></script>
<script src="/myapp/app/controller/LoginController.js?_debugResources=y&n=1336614540164" type="text/javascript" ></script>
<script src="/myapp/app/controller/ProfileController.js?_debugResources=y&n=1336614540164" type="text/javascript" ></script>

...

对铁路公司来说,一个非常令人欢迎的事实是,我们可以把可执行的法典放在一个议事档案中!

问题回答

暂无回答




相关问题
how to use DynamicResource in the code behind?

I d like to be able to set a property to a dynamic resource programmatically. myControl.Property = this.Resource[key] is not a valid response, since if the resource with the key key is replaced, ...

PHP - Foreach loops and ressources

I m using a foreach loop to process a large set of items, unfortunately it s using alot of memory. (probably because It s doing a copy of the array). Apparently there is a way to save some memory with ...

C# Play MP3 from Resources with MCI or WMP control?

I have a MP3 file in my Resources of Visual C#. I m trying to find out if there is a way I can play this MP3 in a Windows Media Player control or with MCI, I m not particular. I m fairly new to C#. ...

Convert files of any types to a file with c strings

Please suggest a small command-line utility (for Windows) to convert files from particular directory to a valid c file. Maybe it can be done just with batch commands? The resulting file should look ...

How to sort ResourceSet in C#

I have a resource file named filetypes.resx. Some how I figured out to bind the resource values to dropdownlist, but I don t know how to sort the values of ResourceSet. Here is what I did so far, ...

热门标签