patternlab-php-core icon indicating copy to clipboard operation
patternlab-php-core copied to clipboard

Installable Components

Open dmolsen opened this issue 8 years ago • 22 comments

I've been interested in the idea of installable patterns for PL2 for a while now. Once InstallerUtil was done I saw that it was more flexible than just installing PatternEngines and StarterKits. Now that there is interest in components and they appear to generally work "installable patterns" can be expanded to "installable components." This would allow the use of something like composer require phase2/tabbed-panel in a project which would install Phase 2's version of a tabbed panel. Alternatively, a StarterKit could consist entirely of component dependencies. Or we allow a "fetch component" feature to keep components out of a dependency tree. All of this is almost doable today. The biggest issues are...

  • where do component files go?
  • how do we gracefully handle prompting the user for where to install them?
  • what to do with asset files related to components?

I'd like to make the following proposal about Packagist-based components:

  • component authors can define a default path for a component in composer.json. e.g. atoms/general.
  • on install PL2 would look at the default path and:
    • try to match it to disk and respect numbering of folders. if that didn't work it...
    • try use each directory in the default path as keywords and compare against a user-supplied mapping in ./config. if that didn't work...
    • prompt the user to type in an install location

Now this works really well for PL2 things like patterns, data, info files. Where it breaks for me are assets like images, javascript, css and sass/less. How magical do we think this needs to be? Plugin assets that are meant to modify the the PL viewer are installed in a way that's pretty damn magical but no one really cares about the final, standardized location for those plugins.

Is this something worth worrying about? Ideas for how to address non-PL2 assets?

dmolsen avatar May 15 '16 03:05 dmolsen