Comments (2)
I agree, and meant to bring that up earlier.
The way it should work is that pages should be able to take just a .json
file. That will work for a few use cases and keep thing DRY.
But there are a lot of instances where the page's markup will differ from
the main template. It would be cool to control all variations (for example,
a homepage page instance where there's an emergency, or during a live
event, or some other special edition) with JSON, but I can see how that
could end up being cumbersome. So I still think it would be valuable to be
able to create .mustache files for pages.
On Sunday, October 27, 2013, Dave Olsen wrote:
Should Pages have mustache-based mark-up? It seems like they really should
just be Templates (the base mark-up) with custom data (to make the
Pages more "real"). If that's the case then the only files that should
be in 04-pages/ should be the .json files. This would make PL a little
DRYer and make it easier to update Templates and Pages at the same time.For example, the changes made when updating 03-templates/homepage.mustacheshould be seen when viewing templates
homepage or pages > homepage on the PL site.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28
.
Brad Frost
http://bradfrostweb.com
http://twitter.com/brad_frost
Sent from a tiny computer that fits in my pocket and also happens to make
phone calls.
from patternlab-php.
Ok, so we want a one-to-many relationship between Templates and Pages. And we might be able to "turn on" sections of a template with the JSON. For example, you could have a Template named homepage.mustache
with this code:
<h1>Hello World</h1>
{{# emergency }}
<div>Emergency!!!!!</div>
{{/ emergency }}
<div id="normal-news">
[ normal stuff ]
</div>
And then have a default Page JSON for that template named homepage.json
which was a vanilla data replacement looking like:
{
"normal-news-items": [ stuff ]
}
With this data the emergency section of the homepage Template doesn't show when rendered because there's no emergency
variable. To get the emergency version of the template we'd have a second Page JSON file, named homepage-emergency.json
, which showed had the emergency
variable:
{
"emergency": true;
}
That's a way of giving Mustache the ability to handle a simple if
statement. PL could use homepage.json
as the base and then render Pages based on one or more related JSON files. By having homepage.json
and homepage-emergency.json
files we'd end up with two rendered Pages based on one Template.
I can keep the Pages support we have now too.
from patternlab-php.
Related Issues (20)
- Gruntfile Configuration - Needs Updated? HOT 1
- Documentation for Upgrading from 1 -> 2 HOT 1
- Adding tabs to the UI (a la plugin-node-tab) HOT 2
- "The partial could not be found" when using styleModifier HOT 1
- PatternStates not working as expected HOT 5
- Best Practice - Laravel HOT 5
- Possible to add a space in a custom Pattern State name? HOT 1
- Using pattern-specific data when using 'View All'
- Documentation request: Viewing Patterns (connection refused error when viewing on other computers on the same network) HOT 1
- Serving patternlab doesn't seem to work correctly from a gulp shell task
- Adding multiple classes via styleModifier not working HOT 1
- Class '\PatternLab\TwigNamespaces\PatternLabListener' not found HOT 1
- Add favicon and touch icons to Pattern Lab?
- Is there a convention to integrating Vue components into Patternlab?
- Patterlab-php with Mustache starter-kit not Installing correctly
- Patternlab php not working with PHP 8.0 HOT 3
- Pulse rates
- Pattern Fluctuation
- Patternlab and PHP 8.1? HOT 1
- pattern-lab/core and its doctrine/collections dependency is not compatible with PHP 8.1 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from patternlab-php.