cearls / timberland

A modern WordPress theme using Timber, Advanced Custom Fields Pro, Vite, Tailwind and Alpine.js
MIT License
84 stars 21 forks source link

How to access a field inside and from a component twig? #6

Closed chrisvidal closed 3 years ago

chrisvidal commented 3 years ago

I created few fields until my banner component and try to use them in the index.twig without success like this {{ header }} How can I access this fields in the component? thanks

cearls commented 3 years ago

You can access it like this:

{{ data.header }}

I need to add this to the documentation and add a better example component.

Thanks for taking the theme for a spin.

chrisvidal commented 3 years ago

got it, thanks.

with regards to the component, it seems like if the 3 files (twig, js and css) are not present, something is not rendered as expected. My use case was that I didn't need any js code, hence I didn't create a .js file. But I notice that in that case the style.css was not applied.

cearls commented 3 years ago

Just to confirm, are you running npm run watch so that css and js changes are compiling?

chrisvidal commented 3 years ago

maybe I tried the others, like watch poll and hot. would that be the reason?

cearls commented 3 years ago

Yes, that might be it. You need to run npm run watch during development so that changes to js and css files are compiled.

chrisvidal commented 3 years ago

ok, noted with thanks

I just applied the change with tailwindcss/jit and noticed some issues. In one of my components, I am using classes like md:grid-cols-3 and they are not present anymore in the generated stylesheet.

cearls commented 3 years ago

I tested and was able to confirm that my changes were present. Did you run npm install after pulling in the latest tailwindcss/jit package? It also might help to restart the npm run watch command.

I probably should have tagged jit as a new release, but so far you're the first brave soul that I know of to try this theme out. I appreciate your patience as we work out the kinks.

chrisvidal commented 3 years ago

I really enjoy the implementation of the components thing. Really accelerate the dev process.

Let me try again with jit and report back.

I am enjoying playing with your theme on a new project for a client, I am no expert in WP at all, and with your theme I find it quite easy so far. I am struggling with integrating with LearnDash, and trying to access the course/lesson content from the theme without using their shortcode as I need a custom design implementation.

chrisvidal commented 3 years ago

which leads me to the question: how do I create a single template for displaying my course in the theme?

chrisvidal commented 3 years ago

which leads me to a second question: it seems that the theme is overriding anything that would be set by external plugins. In a page called 'courses', I am using a building shortcode block from a plugin, to list all the courses; it displays nicely in the page editor but when I preview the page it displays the archive template from the theme, as a simple list of post tease. Is there a way to go around this by any chance?

chrisvidal commented 3 years ago

with regard to jit, I know what is going on: I am using scss styling and jit does not compile them properly, it sees them as css and mess everything around.

creating a PR to fix this

chrisvidal commented 3 years ago

with regards to jit, i noticed a lot of issues. No idea if this is related to tailwind itself or to the theme.

but the styles are not rendered anymore in the proper order when nested. the nested style are rendering first, which does not make any sense.

for some reasons, in the components styles like lg:w-1/2 are not rendered in the final styles.

chrisvidal commented 3 years ago

I switched the mix config with jit and sass (because I feel it's quite convenient) following this config: https://github.com/florianbouvot/laravel-mix-boilerplate/tree/next