function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jpatel@alternajpatel@alterna 

How to deploy Static Resource file with GULP

We have an SPA app developed using Agular JS. I want to modify some texts in one of the page so I pull the Static Resource folder called "myApp" from the Sandbox server and I have made the desired changes.

However, when I tried to Zip the folder and attempt to upload it to Static Resource in our Sandbox then I notice that our app is unable to load. I used Google Chrome to inspect the Code and I see that it says it unable to find all the .js files in the /Resource/.. folder and etc.

It has come to my attention that I have to use GULP to deploy the static resource folder instaed of doing the way I do with ZIP.

So, I have went ahead and install Node.Js V8.11.1 and GULP V3.9.1.

and I also ran these couple lines:
 
$ npm init
$ npm install gulp gulp-zip gulp-jsforce-deploy --save-dev

My static resource folder is structered like this now after I installed GULP and stuff. After do the comparision, I find that the folder and files in bold are added from installing GULP.
 
└── myApp
    ├── app
    ├── assets
    ├── node_modules
    ├── styles    
    ├── myCompany.page
    ├── gulpfile.js 
    ├── package.json
    ├── package-lock.json
    ├── systemjs.confi.js

Note I created the gulpfile.js and added the following code to it.
 
var gulp = require('gulp');
var zip = require('gulp-zip');
var forceDeploy = require('gulp-jsforce-deploy');

gulp.task('deploy', function() {
  gulp.src('./myApp/**', { base: "." })
    .pipe(zip('pkg.zip'))
    .pipe(forceDeploy({
      username: process.env.SF_USERNAME,
      password: process.env.SF_PASSWORD
      , loginUrl: 'https://test.salesforce.com'
      //, pollTimeout: 120*1000
      //, pollInterval: 10*1000
      //, version: '33.0'
    }));
});

And I run this line of code to deploy (where I use my real username and password for my sandbox). 
Note: I kinda follow the idea from here https://github.com/jsforce/gulp-jsforce-deploy/blob/master/README.md

 
SF_USERNAME=myUserNameForSandbox SF_PASSWORD=mySandboxPassword gulp deploy

But....the above line of code just won't run because it says SF_USERNAME is unrecognize.


So, any help please?? How can I deploy my static resource folder to my Sanbox?

Thank you for your help.