Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Serving patternlab doesn't seem to work correctly from a gulp shell task #391

Open
zorida opened this issue Jul 17, 2017 · 0 comments
Open

Comments

@zorida
Copy link

zorida commented Jul 17, 2017

Whenever i try to use Gulp with gulpfile.js in the project root to serve patternlab, whose folder is placed at first level inside the project (i.e. in '[project folder]/styleguide'), i manage to generate (build) the patterns, but not to serve them.

$ gulp pl-serve
[17:30:33] Using gulpfile ~/[foldername]/gulpfile.js
[17:30:33] Starting 'pl-serve'...

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: Command failed: php core/console -s --with-watch

    at ChildProcess.exithandler (child_process.js:204:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Socket.<anonymous> (internal/child_process.js:342:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:501:12)

my code inside the gulpfile.js related to the 'pl-serve' task:

gulp.task('pl-serve', function() {
  var options = {
    continueOnError: false, // default = false, true means don't emit error event
    pipeStdout: false, // default = false, true means stdout is written to file.contents
    customTemplatingThing: "test" // content passed to gutil.template()
  };
  return gulp.src('./styleguide')
      .pipe(exec('php core/console -s --with-watch', options)).pipe(exec.reporter());
});

I tried the following:
using only one command i.e. exec('php styleguide/core/console -s --with-watch' ) ;
using the expression for consecutive commands i.e. exec('(cd styleguide;php core/console -s --with-watch)' ) with and without round brackets;
replacing -s with --server;
using the currently deprecated gulp-shell extension instead of gulp-exec;
changing styleguide with './styleguide' or './styleguide/';
build the project under Windows 10 and Ubuntu Linux 16.04, currently developing under the second one.

if I use the terminal to move inside styleguide folder, and type 'php core/console -s --with-watch', the site is generated and served on the local host, and patternlab seems able to correctly detect changes in .twig files.

This works instead, and builds the site if called by typing gulp pl from the cmd line:

gulp.task('pl', function() {
  var options = {
    continueOnError: false, // default = false, true means don't emit error event
    pipeStdout: false, // default = false, true means stdout is written to file.contents
    customTemplatingThing: "test" // content passed to gutil.template()
  };
  return gulp.src('.')
      .pipe(exec('(cd styleguide; php core/console --generate)', options)).pipe(exec.reporter());
});

Maybe I'm doing something wrong, I used PL both in node and php versions and now I can't get it to work from there. It is not mandatory, but it could be useful.
Any help would be appreciated. Thanks in advance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant