aleksip / plugin-data-transform

Data Transform Plugin for Pattern Lab PHP
GNU General Public License v2.0
34 stars 10 forks source link

include() in pattern data only working on initial build #16

Open alamowo opened 6 years ago

alamowo commented 6 years ago

Hi,

when working on a pattern in which I include another pattern using the [pattern].yml or [pattern].json file, it only works on the initial build of the pattern lab. When running php core/console --watch and i change that data file or simply some css that makes PL recompile to the public folder, I only get Array as output.

Then I have to quit the PL watch task an rerun it.

Example YAML:

mol_accordion_elements:
  '1':
    title: A File
    icon: 'icon_download'
    content:
      include():
        pattern: atoms-file
        with:
          file:
            filename: file.pdf
            filesize: 96KB
            permalink: http://test.com/file.pdf
        only: true
aleksip commented 6 years ago

Hi, thanks for reporting this! Unfortunately DTP does not work properly when using PL's --watch feature. I hope to find some time to investigate the problem in the near future, but meanwhile I suggest using something like Gulp to watch for changes and call PL's --generate.

One example of such a Gulp script (with additional Browsersync and Sass support) can be found here: https://github.com/aleksip/shila-drupal-theme/blob/dev/gulpfile.js

alamowo commented 6 years ago

Hi, that actually sounds like a solution to us. We were investigating the problem right now and assume that its related to this file: /pattern-lab/core/src/PatternLab/Console/Commands/ServerCommand.php.

On line 66 the watch command is build and it gets the hard coded option --no-procs which disables all plugins for that process. But i guess this happens in multiple locations. Cause it's not only related to the --server --with-watch command, but also to the --watch itself.

For now I'm gonna reconfigure webpack ;)

Thank you very much!

aleksip commented 6 years ago

Thanks, good to know! I had a suspicion the problem might be related to PL itself.