qExt
is a tool that allows you to quickly and easily spin up Qlik Sense Extension projects and deploy them to a server environment
I have Qlik Sense Server installed within a VM on my machine, but wanted to be able to develop outside of the VM. I also wanted to be able to automate the process of zipping up an extension, deleting the old extension, and importing the new extension.
qExt makes use of the Qlik Sense QRS APIs. In order to delete and post extensions to the server from your local machine, you will need to set up a Virtual Proxy in Qlik Sense Server with Header Authentication to allow these actions to be taken. For steps on setting this up, check out the Setup Virtual Proxy with Header Authentication section of [this article] ().
npm install -g qext
- Run
qext --create-extension [name] --install
to create a new extension project in your working directory and install all dependencies - Once installation completes, change your working directory to the project directory that was just created
- Update
server.host
property value to the hostname of your Sense Server and theserver.headers.hdr-usr
property value to the domain and username of a Qlik Sense admin account - Run
npm run watch-webpack-deploy-server
to start watching and deploying your source files every time an edit is made
The same functionality of qExt can be used in a Qlik Sense Desktop environment. All we need to do is point the deployment location to the Qlik Sense Extensions folder. To do this, repeat steps 1 & 2 above in the Server Usage section. Then:
- Update
desktop.destination
by replacing%username%
in the path with the username associated with your machine - Run
npm run watch-webpack-deploy-desktop
to start watching and deploying your source files every time an edit is made
In the Usage section above, we saw 2 examples of npm scripts that can be run in your Extension development environment. Here is a full list of all scripts that can be run
-
build-webpack
will bundle your code using Webpack and Babel allowing you to use ES6 in your extension source. It will also zip up the bundled files. -
watch-webpack
will watch yoursrc
directory and bundle and zip your code anytime a change is made. -
build-vanilla
will not bundle your code, but instead will zip up all source files as they are in the source. -
watch-vanilla
will watch yoursrc
directory and zip up all source files anytime a change is made. -
deploy-server
will deploy the zipped up extension file from thedist
directory to the Qlik Sense Server. -
deploy-desktop
will deploy the zipped up extension file from thedist
directory to the Qlik Sense Desktop extensions directory location. -
build-webpack-deploy-server
will bundle your code as in step #1 and then will deploy the resulting zip file to the server. -
watch-webpack-deploy-server
will watch and bundle your code as in step #2 and will deploy the resulting zip file to the server any time a change is made. -
build-webpack-deploy-desktop
will bundle your code as in step #1 and then will deploy the resulting zip file to the desktop. -
watch-webpack-deploy-desktop
will watch and bundle your code as in step #2 and will deploy the resulting zip file to the desktop any time a change is made. -
build-vanilla-deploy-server
will zip your code as in step #3 and then will deploy the resulting zip file to the server. -
watch-vanilla-deploy-server
will watch and zip your code as in step #4 and will deploy the resulting zip file to the server any time a change is made. -
build-vanilla-deploy-desktop
will zip your code as in step #3 and then will deploy the resulting zip file to the desktop. -
watch-vanilla-deploy-desktop
will watch and zip your code as in step #4 and will deploy the resulting zip file to the desktop any time a change is made.
When a new project is created using qExt, you will see the directories src/assets
and static/
.
The src/assets
folder allows you to load images into your extension by relative path. For example, let's say you have a file logo.png
stored in src/assets
that you want to include as a background in your extension using CSS. You can pull this image in by defining background-image: url('./assets/logo.png')
. When Webpack builds your extension, it will convert the url automatically so that it points to /extensions/extension-name/logo.png
This isn't limited to just image urls in css - The same can be defined in html (<img src="./assets/logo.png">
) and even in your javascript (import logo from "./assets/logo.png"
).
Files stored in the static
directory don't get processed by Webpack, but instead are copied directly into the distribution folder as-is. In order to use files from the static
directory in your project, you must reference them by absolute path (ex. background-image: url("/extensions/extension-name/static/logo.png")
).