Hi Marius, Globally I like the idea, it sounds like a good feature, with a lot of use cases.
I have some concerns/questions : * It will be somehow "magical" (kind of the same way aspects act for Java code). There will be a strong need for documentation and explanation so that users can understand why some imports are sometime triggered and sometime not. * In my opinion we cannot release this without a UI that at least lists all SkinExtensions. * Isn't there a risk the TX could be a bit costy for complex documents (big and deep XDOM) ? * Since order matters for both JS and CSS, how do we chose which SX gets included in what order ? (I know this question already applies for our SX plugin - just raising it again now) * This will lead to more and more segmentation in skin files/SX files (JS and CSS). We need to foresee the possibility that some sites want to pack some or all JS and CSS together in one file in production mode. This need to be somehow supported (configuration ?) Jerome. On Mon, Jan 24, 2011 at 5:08 PM, Marius Dumitru Florea <[email protected]> wrote: > Hi devs, > > I have this wiki syntax: > > ----------8<---------- > {{velocity output="false"}} > $xwiki.ssrx.use('uicomponents/widgets/gallery.css') > $xwiki.jsrx.use('uicomponents/widgets/gallery.js') > {{/velocity}} > (% class="gallery" %)((( > image:first.png > ... > image:last.png > ))) > ---------->8---------- > > and I'd like to make the resource import automatic. I think we can > achieve this in two steps. > > (1) Add a way to group skin extensions. I'd like to be able to write this: > > ----------8<---------- > {{velocity output="false"}} > $xwiki.gsx.use('gallery') > {{/velocity}} > (% class="gallery" %)((( > image:first.png > ... > image:last.png > ))) > ---------->8---------- > > (2) Write a rendering transformation that looks for style names (CSS > classes) in the content and imports the skin extension group with the > same name. This way I'd be able to write just: > > ----------8<---------- > (% class="gallery" %)((( > image:first.png > ... > image:last.png > ))) > ---------->8---------- > > Let's consider the technical details now: > > (1) I propose we add two XWiki classes: > > XWiki.SkinExtension > * type (StaticList): jsrx > * resource (String): uicomponents/widgets/gallery.js > > XWiki.SkinExtensionRole > * role (String): gallery > > which will be used by a new SkinExtension plugin and component > (hint=gsx). The XWiki.SkinExtensionRole objects will be joined with > XWiki.SkinExtension objects by document id. In other words, in order to > create a skin extension group you have to add a XWiki.SkinExtensionRole > object and multiple XWiki.SkinExtension objects to a document. > > To make group creation easier for StyleSheetExtension and > JavaScriptExtension the new skin extension plugin will include them > automatically in the group defined by the XWiki.SkinExtensionRole. In > other words if you want to group a JSX and a SSX that are on the same > document you just have to add a XWiki.SkinExtensionRole object to that > document. > > (2) The rendering transformation that will automatically import the skin > extension groups based on style names will use the skin extension > component defined at step (1). This transformation should be the last > one executed. > > WDYT? I'd like to implement this ASAP as it doesn't seem to be very > complicated. > > Thanks, > Marius > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

