4 Replies Latest reply: Jul 7, 2017 3:53 AM by Darius Pranskus RSS

    Loading resources from parent folder

    Darius Pranskus

      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