Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
d_pranskus
Contributor III

Loading resources from parent folder

Hi

I would like to create couple of extensions and pack them as a package. Also I would like to create couple of AngularJs directives and use them in multiple extensions. In addition I would like to use node packaging to load my dependencies. So I was thinking to have the following folder structure.

ext-package-root

     directives

          directive1

               directive1.js

          directive2

               directive2.js

          .....

     node_modules

          font-awesome

               css

                    font-awesome.min.css

          bootstrap

               css

                    bootstrap.min.css

               js

                    bootstrap.min.js

     extensions

          extension1

               ext1-properties.js

               ext2-paint.js

               ext1.js

               ext1.qext

          extension2

               ext2-properties.js

               ext2-paint.js

               ext2.js

               ext2.qext

     package.json

Then, for example in the ext1.js file I would like to load resources from node_modules or directives. I tried to do it with require.configure and without, using absulute folder, like "/extensions/ext-package-root/node_modules/font-awesome/css/font-awesome.min.css", or relative folder, like "../../node_modules/css/font-awesome.min.css", but it does not work:

define([

     'qlik',

     'text!../../node_modules/css/font-awesome.min.css'     //this line breaks the code

], function(qlik, fa) {

     ....

     ....

});

What might be a problem? How can I load the resources which are not inside my current folder, but in the parent or even othe folder?

Many many thanks

1 Solution

Accepted Solutions
erik_wetterberg
Honored Contributor

Re: Loading resources from parent folder

Hi Darius,

You need to add one or more qext files. If you for example add a 'root.qext' to the root,

you can use 'extensions/root/node_modules/....'  as requirejs path.

In the qext file, set the type field to something other than 'visualization' or 'mashup'. Create a separate zip file for the stuff you want to load this way.

Hope this helps

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
4 Replies
erik_wetterberg
Honored Contributor

Re: Loading resources from parent folder

Hi Darius,

You need to add one or more qext files. If you for example add a 'root.qext' to the root,

you can use 'extensions/root/node_modules/....'  as requirejs path.

In the qext file, set the type field to something other than 'visualization' or 'mashup'. Create a separate zip file for the stuff you want to load this way.

Hope this helps

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
erik_wetterberg
Honored Contributor

Re: Loading resources from parent folder

Just a small correction: you don't need to create separate zip files, you can have the whole structure in a common zip file with several qext files. Don't put several qext files in the same directory though.

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
d_pranskus
Contributor III

Re: Loading resources from parent folder

Hi Erik

Thank you very much

Will check this out.

d_pranskus
Contributor III

Re: Loading resources from parent folder

It realy worked

Thank you very much, Erik.