1

The issue is, I would like to use all benefits of tasks runner and bower into my existing Zend-Project. I'm not sure, how should I restructure my whole project folder. My current structure looks like follows:

   config
   module
   vendor
   public
     css
     js
       libs
         jquery
         bootstrap
       controller1
         jsController1.
         etc
     index.php

From this (Gulp and Bower - creating proper files structure) I know, that I have to create a separate folder to save all libraries installed from bower and then I have to copy them with gulp into the public folder. Now depending on enviroment (Production or Development) I want to use minified css and js scripts. So should I create 2 public - folders and depending on enviroment change base path for zend? Or what's the best way to perform that?

Additionally I would like to integrate browser-sync into this project (cause of livereload). Therefore I want to use gulp-connect to start the php-server. But then the enviroment variables from apache are not set. How can I set it? According to documentation I have to add newArgs (cause my Options are array) "APPLICATION_ENV=development". But if add this after comma, i get error: "Could not open input file: APPLICATION_ENV=development"

My currenty gulfile:

var gulp = require('gulp'),
php  = require('gulp-connect-php');


gulp.task('php', function() {
php.server({
    configCallback: function _configCallback(type, collection) {
  // If you wish to leave one of the argument types alone, simply return the passed in collection. 
  if (type === php.OPTIONS_SPAWN_OBJ) { // As the constant suggests, collection is an Object. 
    // Lets add a custom env var. Good for injecting AWS_RDS config variables. 
    collection.env = Object.assign({
      APPLICATION_ENV: "development"
    }, process.env);

    return collection;
  } else if (type === php.OPTIONS_PHP_CLI_ARR) { // As the constant suggests, collection is an Array. 
            let newArgs = [
      '-e',                    // Generate extended information for debugger/profiler. 
      '-d', 'memory_limit=2G'   // Define INI entry, Up memory limit to 2G. 
      ,"APPLICATION_ENV=development"
    ];

    // Ensure our argument switches appear before the rest. 
    return newArgs.concat(collection);
  }
}
     ,
    base: 'public',
    port: 8010, 
    keepalive: true}, 
function _connected_callback() {
       console.log("PHP Development Server Connected.");
     });

} );

tookie009
  • 186
  • 1
  • 14

0 Answers0