More details on "raptor-dust" module

33 views
Skip to first unread message

Mauro Verrocchio

unread,
Jan 30, 2014, 6:34:32 PM1/30/14
to rapt...@googlegroups.com
Hello everybody!
I came across RaptorJS a few weeks ago and immediately fell in love with it!
I really like the packaging and opmitizing features and this seems the holy grail I was looking for :)
I would like to add it to the project I've been working on for quite some time now, a small application running on express, but I I would like also to keep the template rendering (Dustjs) and all the helpers and templates of course..I found the raptor-dust module then, which seems to be the solution, but I cannot make it work :(
Can anyone help me with some working example?

Thank in advance! :)
Mauro

Patrick Steele-Idem

unread,
Jan 30, 2014, 9:26:10 PM1/30/14
to rapt...@googlegroups.com
Hi Mauro,

Glad to hear that RaptorJS is working out for you! The "raptor-dust" module was an experiment to see if we could create helpers that could be included in both Dust templates (as helpers) and Raptor Templates (as custom tags). This allowed us to integrate the RaptorJS Optimizer tags into both Raptor Templates and Dust. For Dust, the code to utilize the RaptorJS Optimizer helpers looks like the following:
{@optimizerPage packagePath="/ui-pages/dust/package.json" name="dust"/}
<html>
    <head>
        <title>Dust Demo</title>
        {@optimizerSlot name="head" /}
    </head>
    <body>
        <h1>Hello from Dust!</h1>
        
        {@optimizerSlot name="body" /}
        
    </body>
</html>



We got it working for our Node.js stacks, but it could probably use some cleanup and it definitely could use a README. With that said, here is the code that we used to enable the module:
require('raptor-dust').configureDust(require('dustjs-linkedin'), srcDir);


I hope that gives you enough guidance to get it working. If you run into issues please let me know or feel free to create a Github issue or send a Pull Request.

FYI, we are refactoring RaptorJS to make it easier to use. Part of this includes separate out the "raptor" module into a lot of independent and smaller modules, but we are also making significant improvements to the RaptorJS Optimizer and Raptor Templates. You can check out the plan on the following page:

Here's where the new code for RaptorJS 3 lives for now:

Thanks,
Patrick

Mauro Verrocchio

unread,
Jan 31, 2014, 3:52:10 AM1/31/14
to rapt...@googlegroups.com
Arrgh! It was so simple!
What I was trying to do was something like:

{@optimizerPage name="dust"}
   <module name="raptor"/>
   <js path="index.js"/>
   <css path="index.css"/>
{/optimizerPage}

because I was looking at the async-loaded example, but cleary the dust helper doesn't work that way! :)
I will certainly take a peek at the new version!

Thanks so much for replying so quickly!
Mauro.

Patrick Steele-Idem

unread,
Jan 31, 2014, 5:37:07 PM1/31/14
to rapt...@googlegroups.com
Glad you got it working. Unfortunately not being able to inline dependencies into the template is a current limitation for Dust, but that could be resolved in the future (although the syntax will probably be different).

The raptor-optimizer module is relatively complete but it is not yet compatible with the Dust helpers or Raptor Template custom tags. Currently the new RaptorJS 3 modules lack READMEs but there are test cases. If you decide to be adventurous and try out the new modules, please let us know what you think and if you run into any issues (most likely you would run into issues).

--Patrick
Reply all
Reply to author
Forward
0 new messages