Let's say "a" and its associated files are in a folder called a-1.0.0. Try 
dropping the folder into META-INF/assets and shim it by contributing to 
ModuleManager:

        public static void contributeModuleManager(
                        MappedConfiguration<String, Object> configuration,
                        @Path("/META-INF/assets/a-1.0.0/a.js") Resource a,
                        ...)

                configuration.add("a", new 
JavaScriptModuleConfiguration(a).dependsOn("whatever"));
                ...
                }

Now you can refer to it as module "a". If a.js was already an AMD-compliant 
module, that's fine, RequireJS will figure handle it. If a.js already does 
*require("whatever")* then you can leave out the .dependsOn("whatever") shown 
above.

If it has css files, you might like to put them in a JavaScriptStack so that 
their path is kept in one place.

public class ASupportStack implements JavaScriptStack {

        private final AssetSource assetSource;

        public ASupportStack(final AssetSource assetSource) {
                this.assetSource = assetSource;
        }

        public String getInitialization() {
                return null;
        }

        public List<Asset> getJavaScriptLibraries() {
                List<Asset> ret = new ArrayList<>();
                return ret;
        }

        public List<StylesheetLink> getStylesheets() {
                List<StylesheetLink> ret = new ArrayList<>();

                ret.add(new StylesheetLink(assetSource
                                
.getClasspathAsset("/META-INF/assets/a-1.0.0/a.css")));
                ret.add(new StylesheetLink(assetSource
                                
.getClasspathAsset("/META-INF/assets/a-1.0.0/a.print.css"),
                                new StylesheetOptions("print")));

                return ret;
        }

        public List<String> getStacks() {
                return Collections.emptyList();
        }

        @Override
        public List<String> getModules() {
                return Collections.emptyList();
        }

}

In AppModule:

        public static void 
contributeJavaScriptStackSource(MappedConfiguration<String, JavaScriptStack> 
configuration) {
                configuration.addInstance("ASupportStack", ASupportStack.class);
        }

In each page or component that uses module "a", either @Import the stylesheets 
or @Import the JavaScriptStack. I wish there was a way that would import it for 
you every time refer to module "a" but I don't know of one.

I hope this is helping.

Geoff

On 23 Mar 2015, at 1:06 pm, Rural Hunter <ruralhun...@gmail.com> wrote:

> I already did that. The problem is this: I have a 3rd party module A. Both
> my own code and another 3rd party module B depend on it. The standard
> location of module A should be at classpath:META-INF/modules/ but it brings
> in a lot of js files and sub-folders and makes the module root path(
> classpath:META-INF/modules) a bit messy. So I want to put module A at
> classpath:META-INF/modules/A. How can I achieve it?
> 
> 2015-03-22 18:39 GMT+08:00 Chris Poulsen <mailingl...@nesluop.dk>:
> 
>> Drop the 3rd party module in the usual place for modules
>> (classpath:META-INF/modules) and reference it.
>> 
>> http://tapestry.apache.org/javascript-rewrite.html has some info on the
>> infrastructure and the tapestry source code (setup of the core
>> stack/bootstrap modules etc. are good inspiration as well),
>> 
>> 
>> 
>> 
>> On Sat, Mar 21, 2015 at 4:19 PM, Rural Hunter <ruralhun...@gmail.com>
>> wrote:
>> 
>>> How to work out if I want to config the path of a third-party module if I
>>> use js stack?
>>> 
>>> 2015-03-20 17:07 GMT+08:00 Chris Poulsen <mailingl...@nesluop.dk>:
>>> 
>>>> In a javascript stack?
>>>> 
>>>> On Fri, Mar 20, 2015 at 4:05 AM, Rural Hunter <ruralhun...@gmail.com>
>>>> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> I'm testing tapestry 5.4. I'm wondering where to put the
>>> requirejs.config
>>>>> code for my own modules and third-party modules?
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>> 
>>>>> 
>>>> 
>>> 
>> 

Reply via email to