plugin-data-transform icon indicating copy to clipboard operation
plugin-data-transform copied to clipboard

include() in pattern data only working on initial build

Open alamowo opened this issue 7 years ago • 3 comments

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

alamowo avatar May 28 '18 14:05 alamowo

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

aleksip avatar May 29 '18 07:05 aleksip

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!

alamowo avatar May 29 '18 07:05 alamowo

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

aleksip avatar May 29 '18 07:05 aleksip