Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
d_pranskus
Partner - Creator III
Partner - Creator 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
ErikWetterberg

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

View solution in original post

4 Replies
ErikWetterberg

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

ErikWetterberg

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

d_pranskus
Partner - Creator III
Partner - Creator III
Author

Hi Erik

Thank you very much

Will check this out.

d_pranskus
Partner - Creator III
Partner - Creator III
Author

It realy worked

Thank you very much, Erik.