Global assets (scripts, etc.) #64
Comments
I guess this could be done as a JSON config file. Sound ok? Better format? |
since you're dealing with this too... what say you? |
Oh, and you can make references to JS and CSS in |
I do not consider myself an ace JavaScript developer by any means, but what if you had JavaScript that applied to more than one pattern? If you added it to every So you'd probably want to preface it with I'm fine with JSON. I'd be fine with a more global header/footer include, too. I don't know the best way to execute... I think Pattern Lab's pretty awesome so far, so it feels presumptuous to impose my opinion regarding organization. |
I think the right format might be as patterns. I'm thinking they would live at
I like dealing with these in the patterns folder instead of in the I also don't like the JSON route, just because I think it overcomplicates things. If I just want to include some scripts or stylesheets or whatever in the header and footer, I shouldn't have to deal with JSON configurations to do so. By treating them as patterns, people can edit all their stuff in the So what do you think? I started working on this, but @dmolsen, I might need a little help making sure everything is showing up in the right places in the templates. |
I dig that idea. I can't think of any specific use cases other than including |
I'm thinking including/excluding |
But they're not patterns. You're now hard coding that "00-atoms" has to exist for this feature to work. That goes against the flexibility for renaming. They'd also show up in the nav and style guide as well as have their own view all page which seems odd. I don't think we want to start hard coding exceptions. It sucks that it needs to be something outside patterns but it probably should be. It'd be easier to override on a "pattern" basis that way too. For example, "source/_patterns/03-templates/homepage-header.mustache" overrides "source/_meta/header.mustache". The previous was not a fully baked idea ;) I agree on the "core" nature of patternlab-files. I was simply pointing out that right now it'd work. Sent from my iPhone
|
@dmolsen I see your point, that is probably a presumptuous example. Maybe part of the difficulty I have in wrapping my head around a particular implementation is that the use case doesn't necessarily map to a pre-existing convention of the tool. It's mostly like a pattern, except it isn't presented in any overt way and it occurs regardless of which pattern(s) is/are being viewed. It's kind of like My expectation when I first started working with Pattern Lab was that every file included in (Just some food for thought. 🍔 ) |
I apologize. I'm not sure if it was obvious but my last comment was targeted at @bradfrost's suggestion. FWIW, I'm feel like there are two issues to balance:
These are the current global header and footer files that get appended to pattern detail pages. They mimic Brad's original Including global assets seems to come down to finding a way to tack data into the header and footer so that's what I've focused on. The Options in DetailI think there are four options for including that info into a global header & footer found in
TL;DRI'm sure I'm overlooking use cases or issues. I'm not promising I can definitely get a chosen solution working but at least this is a starting point. Brad, if you have something already working we can go with that. So summing up:
|
@dmolsen But an exception is made for Any of the proposed solutions would solve the issue as I encountered it in the project I'm working on. The only one that probably feels the least immediately intuitive (which I know is a tad ironic as it seems partially based off my mistaken assumption about how the Thanks for giving this issue so much thought. Warms my heart! 😃 |
Yeah, you got it. :) For now it looks like we're going with point 1. That's the solution Brad originally laid out. Not a huge fan but it's now working in the I'll leave this issue open for a little bit just in case Brad changes his mind. |
Doesn't seem like Brad changed his mind so sticking with what we have and closing this issue. |
It would be nice if there were a way to include stuff for the head and foot of the document without plopping them into a specific pattern.
For example, if I wanted a global
<script>
included for all patterns, it'd be sweet to have somewhere purposeful to put it, instead of in an arbitrary pattern, which feels fragile and a tad hack-ish.Right now you can basically "hide" them in a pattern (
footer.mustache
), or create a pattern with some explanatory text ("this pattern is just for scripts, which is why you can't see anything but this paragraph here"). Probably not ideal.The text was updated successfully, but these errors were encountered: