Office Generator: define office add-in start URL based on build definition.
In this post we will use a gulp-env and gulp-replace node packages to create two different gulp tasks (build-prod and build-dev) these tasks will generate two different manifest files for office add-in each will be suitable for different environment.
The tasks simply replaces a SITE_URL token in the manifest file with the predefined urls in the abovementioned gulp tasks.
In this walk-through we will use the Office-generator created by OfficeDev team to generate a simple outlook add-in, review my previous post for full walk-through of how to use Office generator
In order to use gulp-env and gulp-replace you need to install both modules using npm install as shown below:
after installing the two node packages , open the generated add-in folder using your favorite text editor, in my case I'm using Visual Studio Code
The tasks simply replaces a SITE_URL token in the manifest file with the predefined urls in the abovementioned gulp tasks.
In this walk-through we will use the Office-generator created by OfficeDev team to generate a simple outlook add-in, review my previous post for full walk-through of how to use Office generator
In order to use gulp-env and gulp-replace you need to install both modules using npm install as shown below:
after installing the two node packages , open the generated add-in folder using your favorite text editor, in my case I'm using Visual Studio Code
- let's open gulp.js file which have been generated for us using the office generator
- let's define gulp-env and gulp-replace variables
- now create a gulp task to add our web url to environment variables , one for each environment
- open manifest.xml file and replace the generated url (https://localhost:8443) with SITE_URL string
- create two gulp tasks one for prod build and other for dev build
- now back to the command/termainal window and type
- The manifest.xml file is generated under build folder and it has the production azure url
No Comment to " Office Generator: define office add-in start URL based on build definition. "