简体   繁体   中英

how to use gulp with azure function Nodejs

Use gulp with azure function. Is it possible to use gulp for all azure functionApp?

process.env.NODE_CONFIG_DIR = `${process.cwd()}/config/env`;

import gulp from 'gulp';
import requireDir from 'require-dir';

requireDir('./lib/tasks');

gulp.task('default', ['update-project', 'run-webpack'], () => {
  gulp.src('host.json')
    .pipe(gulp.dest('.deploy/'));

  const devBuild = process.env.NODE_ENV !== 'production';

  if (devBuild) {
    gulp.src('local.settings.json')
      .pipe(gulp.dest('.deploy/'));
  }`enter code here`
});

It seems that the code with gulp you post comes from the GitHub Gisp jordanyaker/gulpfile.babel.js .

If you want to integrate it with Azure Functions and make it run on Azure Functions, I think it's impossible, and Azure Functions is not designed for doing the streaming build operations, and there are not enough resources like time for building and persistent storage.

If you just want to help building your Azure Function automatically by gulp at the develepment stage and deploy a function to Azure after built, I recommended that you can try to use Azure DevOps to do it. Please refer to the offical docuemnts as below to know how to.

  1. Build, test, and deploy JavaScript and Node.js apps
  2. Continuous delivery by using Azure DevOps for Azure Functions
  3. Gulp task
  4. Azure Function App task

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM