0

Gulp3 を Gulp4 に変更しました。gulpfile.js でタスクを作成しました。変更を行っている場合は、Web サイトを構築しなくても、開発モードですぐに確認できます。

gulp.task('serve-php', function () {
  connect.server({
      port: 9001,
      base: 'app',
      open: false
  });
  var proxy = httpProxy.createProxyServer({});
  browserSync.init({
      notify: false,
      port  : 9000,
      server: {
          baseDir   : ['.tmp', 'app'],
          routes    : {
              '/node_modules': 'node_modules'

          },
          middleware: function (req, res, next) {
              var url = req.url;
              if (!url.match(/^\/(styles|fonts|node_modules)\//)) {
                  proxy.web(req, res, { target: 'http://127.0.0.1:9001' });
              } else {
                  next();
              }
          }
      }
  });
  gulp.watch([
      'app/*.html',
      'app/*.php',
      'app/**/*.php',
      'app/**/**/*.php',
      'app/scripts/**/*.js',
      'app/images/**/*',
      '.tmp/fonts/**/*'
  ]).on('change', function() {
    browserSync.reload();
  });
  gulp.watch('app/styles/**/*.scss', gulp.series('styles'));
  gulp.watch('app/fonts/**/*', gulp.series('fonts'));
 });

しかし、実行するgulp serve-phpと、私の Web サイトには css と js がなく、微調整する方法がわかりません。

4

1 に答える 1