Nest js file

I am trying to use a nest_content area so that I can only print my javascript files on my homepage where they are needed. Here is what I used:

[quote]<MySource_AREA id_name="js_1" design_area="nest_content" print="no">

<MySource_SET name="type_codes" value="file" />

</MySource_AREA>[/quote]



In my home customization I have changed print to yes, and selected my javascript file. It seems to all work well, but it does not print it in the code. So, can I even nest a .js file? Or is that only for pages?


You can't nest file assets (as they don't print themselves quite the same as pages). But you can use a standard page for this instead. Create a standard page asset, change it to Raw HTML presentation and Raw HTML content and put your javascript in there instead. :) You can even give the standard page asset a .js extension in the webpath, if you want.

Is this how matrix.squiz.net is doing it show show and hide .js files?


Unfortunately with the above method I can no longer use mysource_files/ in my parse file…


I'm not sure how we do it on matrix.squiz.net actually. :)

[quote]Unfortunately with the above method I can no longer use mysource_files/ in my parse file...[/quote]

Your parse file in the design always supports mysource_files/ -- however, if you're nesting in a standard page that contains JavaScript, you would use the ./?a=XXX style hrefs in the JavaScript. Matrix will then replace those with the correct URLs.

I always assumed you could, because the type codes in the manual specifically have a [i]file[/i] type code in the example :) I just tried it, and it doesn't work with a text file. I suppose you would use it for images and thumbnails only.

Yeah images work. I think it would be super useful to be able to nest things like .js files, .txt files, etc.

This would require a change to the way those files print themselves via Matrix. It's far simpler just to use a Standard Page in Raw HTML mode instead. :)