Menu icon Foundation
Copying php files into dist (6.x)

I am trying to upgrade from 5 to 6 and have some php files that simply need to be copied into the dist directory. I apparently don't have a good understanding of gulp, because I can't make this happen. Adding the extension to the pages task looks like it sends them through panini and they get some default information added that I don't need. I tried setting up a copy task and it runs, but they never get put in dist. Can someone help?

PHP

I am trying to upgrade from 5 to 6 and have some php files that simply need to be copied into the dist directory. I apparently don't have a good understanding of gulp, because I can't make this happen. Adding the extension to the pages task looks like it sends them through panini and they get some default information added that I don't need. I tried setting up a copy task and it runs, but they never get put in dist. Can someone help?

Aaron over 3 years ago

Here's the code I'm using

//Copy php files into dist
gulp.task('copy:php', function() {
  return gulp.src('src/pages/**/*.{php}')
    .pipe(gulp.dest('dist'));
});

 // Build the "dist" folder by running all of the above tasks
gulp.task('build', function(done) {
  sequence('clean', ['pages','copy:php','sass', 'javascript', 'images', 'copy'], 'styleguide', done);
});

// Start a server with LiveReload to preview the site in
gulp.task('server', ['build'], function() {
  browser.init({
    server: 'dist', port: PORT
  });
});

// Build the site, run the server, and watch for file changes
gulp.task('default', ['build', 'server'], function() {
  gulp.watch(PATHS.assets, ['copy']);
  gulp.watch(['src/pages/**/*'], ['pages','copy:php']);
  gulp.watch(['src/{layouts,partials,helpers,data}/**/*'], ['pages:reset']);
  gulp.watch(['src/assets/scss/**/{*.scss, *.sass}'], ['sass']);
  gulp.watch(['src/assets/js/**/*.js'], ['javascript']);
  gulp.watch(['src/assets/img/**/*'], ['images']);
  gulp.watch(['src/styleguide/**'], ['styleguide']);
});

Brian Tan over 3 years ago

See this thread to see if it can help you too. http://foundation.zurb.com/forum/posts/38048-php-and-f6-zurb-template

Aaron over 3 years ago

Yeah, that is what I tried first, but when it runs it through panini, it puts the whole php file inside the default.html layout. Anyway to not include it in panini but include it in the pages process?

I also would rather not move the php files, because the site is launched and urls set.

With 5, I understood grunt much better, and simply copied the php files over into dist under the watch command or build command with no further processing.

Aaron over 3 years ago

For the moment, I have basically moved everything to a separate layout file and removed everything from the default layout except the body inclusion tag. This seems to accomplish my goals, but I would still love to know how to not get every file to get the default layout.