mariusbalcytis / webpack-bundle

Bundle to Integrate Webpack into Symfony
MIT License
122 stars 36 forks source link

Optional webpack-dashboard #39

Closed steven-pribilinskiy closed 7 years ago

steven-pribilinskiy commented 7 years ago

We would like to give ability to particular developer(s) of our repository to toggle webpack-dashboard with a custom user-specific parameter

Unfortunately webpack-dashboard doesn't have yet a --disable argument https://github.com/FormidableLabs/webpack-dashboard/issues/129

So it would be nice to have a disable_webpack_dashboard setting additionally to disable_tty

There's also a trouble with disable_tty, e.g.

        disable_tty: %webpack_dashboard%

leads to an error:

  [Symfony\Component\Config\Definition\Exception\InvalidTypeException]
  Invalid type for path "maba_webpack.bin.disable_tty". Expected boolean, but got string.

also disabling tty is a bad idea as it removes colorization in bash webpack output

steven-pribilinskiy commented 7 years ago

@mariusbalcytis how do you treat Pull Requests? I can try to implement this feature

mariusbalcytis commented 7 years ago

I think you get that error (Expected boolean, but got string.) because the value of %webpack_dashboard% is a string and not a boolean.

Also, you can change tty_prefix without disabling TTY itself.

Example configuration:

config.yml:

parameters:
    default_webpack_prefix: ['node', 'node_modules/webpack-dashboard/bin/webpack-dashboard.js', '--']

maba_webpack:
    bin:
        dev_server:
            tty_prefix: %webpack_prefix%

parameters.yml.dist:

parameters:
    webpack_prefix: %default_webpack_prefix%

To disable dashboard, inside parameters.yml:

parameters:
    webpack_prefix: []

Configuration is made to be more abstract and allow changing webpack-dashboard with some other (or custom) solution. If this would be added as boolean on/off switch, it would be more clear when disabling/enabling it, but would clash with current options. If tty_prefix would be set, but dashboard disabled, should it still be used? Or vice versa.

Does given configuration resolve your issue?

steven-pribilinskiy commented 7 years ago

Unfortunately the custom dev-specific config is in ini file format (legacy stuff, I personally prefer to have yml and json everywhere) and as you know the IniFileLoader parses the file contents using the parse_ini_file function, therefore it is possible to set parameters only to string values. Currently it is not possible to change it easily to yml, that is "a bit" complicated for us (not the format conversion but the deployment part).