aleksip / plugin-data-transform

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

Allow global defaults #1

Closed EvanLovely closed 8 years ago

EvanLovely commented 8 years ago

It would be great if I could use these tools in data.json. In particular, I would like to have this in it:

{
  "attributes": {
    "Attribute()": {
      "class": []
    }
  }
}

Otherwise I need to have that same thing in every pattern's sidecar json file so things like this work:

{%
  set classes = [
    'block'
  ]
%}
<div{{ attributes.addClass(classes) }}>
  <p>Cool stuff here</p>
</div>

Let me know if you'd like me to spin up a sample repo that shows this with more detail; thanks!

aleksip commented 8 years ago

@EvanLovely I think I have figured out how to get this working. Hope to have some time to try it out this week.

aleksip commented 8 years ago

Looks like this is not possible without changes in patternlab-php-core. I have created an issue there.

aleksip commented 8 years ago

@EvanLovely dev branch now has support for global data. Testing it would be much appreciated! Please note the 'Global data and includes' section in the README.

aleksip commented 8 years ago

@EvanLovely Looks like @dmolsen just released an official Data Inheritance Plugin. I'll probably remove this feature from Data Transform Plugin in favour of the official plugin if the functionality is identical.

aleksip commented 8 years ago

Global data is finally supported in the 1.0.0 release of Data Transform Plugin.