PDA

View Full Version : Library Workspace for web components



Raphael Theiler
6-May-2015, 03:23 AM
Working with the webapp framework is great, except for one thing:
I want to create custom components and I want to use them in different projects. For windows applications I can simply create a library workspace and include it everywhere I want to use those components. I want to be able to do the same for my WebApps. It somewhat beats the purpose of a library workspace when you have to copy the CSS, and JS files and then modify the index.html manually to include those.

Can you figure out a way to make "WebComponent libraries" work? I think of something like asset management or something like that. Probably copy the appHtml of the library into a subfolder (or zip or something) of the current project and add some "magic" to include/load whathever is needed in the index.html (with the df-include.js for example).

When the library changes, the subfolder gets updated (based on the version of the library?).

This would really make working with custom web components easier and it would allow us to easily share custom components with each other.

John van Houten
6-May-2015, 03:49 AM
Hi Raphael,

All good points. As you know, maintaining a JavaScript library is an extra challenge because the library must physically live in the workspace's published AppHtml folder otherwise it cannot be loaded to the client.

This means the library must be copied into each workspace rather than having a centralized shared library. It also means there needs to be a mechanizim that detects when the copied library is out of date, and detect when it does not match the corresponding DataFlex server-side wrapper classes. It is not enough just to detect whether the library is up to date, the Studio should support automatically updating the library when it is out of date.

We have solved this problem for our global DataFlex Framework JavaScript library, but to solve this for customer JavaScript libraries will require some extra design which we have not yet got to.

Thanks for your feedback on this, your request is noted.

regards John van Houten

Raphael Theiler
6-May-2015, 06:20 AM
Thank you.

Maybe you can find some inspiration in other projects like "WebJars" (which provide JS- and CSS-Frameworks and libraries for Java/JVM-based WebApps) or JavaScript-projects like Bower or RequireJS.
"WebJars" work well with build-tools like SBT or Maven. You add the dependency (package+version you need) to your build file, and when you build your project it automatically fetches the right version from the repository.
This allows you to have different versions of the same library in different projects (if you want/need that).

But this probably won't make problem with the update and replacement of the "AppHtml"-files simpler :-(

Roel Westhoff [W4]
6-May-2015, 08:32 AM
+1

Samuel Pizarro
6-May-2015, 09:35 PM
Maybe some kind of subdir naming convention (to distinguish between multiple libs and samelib but diff versions of it)
+
use of junction-points (kind of sym-links on windows) in the apphtml dir pointing to the lib ?

don't know it it will solve it completely. just thinking loud to let the experts to throw the rocks ... ;)