Replies: 1 comment 2 replies
-
Hello—Thanks for posting this!
I had no idea that video was on YouTube, so thank you for letting me know! I had planned to trim my beard before the talk, but then I got sick and had to speak over video and it just never happened. Haha. Appreciate it!
Properly documenting how to style menus is certainly a priority. My only unpublished documentation page right now is, "Styling Output from WordPress Core, WordPress Plugins and JavaScript Libraries," but I haven't had time to finish it. This also came up on Twitter this month. I'll try to finish that documentation page in the next few weeks. I'm also hoping to start making videos specifically for the _tw website, and this would be a good one to work on.
This feels like something better left to a video or documentation as well. The problem with including components in the theme is that all of the classes for those components will end up baked into the But fully agreed that this is something that could be documented to better show the possibilities!
In the early days of _tw, Alpine.js was included with every build. The realization I came to was that a large chunk of people were then serving Alpine.js to their site's visitors and getting absolutely nothing out of it. I've since decided that _tw should be exclusively about WordPress and Tailwind, with esbuild included to make adding JavaScript as straightforward as possible. Documentation and screencasts would go along way here as well, though I do cover the Alpine.js / esbuild side here: https://underscoretw.com/docs/esbuild/ If you're curious what it looks like with plugins, this is from a recent project of mine: import Alpine from 'alpinejs';
import focus from '@alpinejs/focus';
import intersect from '@alpinejs/intersect';
import ui from '@alpinejs/ui';
Alpine.plugin(focus);
Alpine.plugin(intersect);
Alpine.plugin(ui);
window.Alpine = Alpine;
Alpine.start(); So it's just a matter of using A similar approach would work for VanJS:
And then in your JavaScript file: import van from "vanjs-core" — Thank you for the suggestions! If you (or anyone reading this) blogs or makes videos about these topics, I'd be very happy to link to them. |
Beta Was this translation helpful? Give feedback.
-
Hello Greg.
Seen your video on yt on wordpress stuff, my comment is above :) nice beard btw xD
So as far i develope with your theme here are my 2 cents, since maybe i have contribuited some how on gutenberg stuff implementation:
I have created amazing things with it: https://github.com/Log1x/navi
-Alpine js default components, most common components like pagination, tags, categories etc. We can grab something from pinesUI etc. As far as i know pines provides best examples, not so extensive but its so well made. https://github.com/thedevdojo/pines
-Alpine.js included properly (yes properly) with every plugin.
My example is here:
function enqueue_alpinejs_and_plugins() {
// Registra i plugin
wp_register_script('alpinejs-morph', get_template_directory_uri() . '/js/morph.min.js', array(), null, false);
wp_register_script('alpinejs-persist', get_template_directory_uri() . '/js/persist.min.js', array(), null, false);
wp_register_script('alpinejs-collapse', get_template_directory_uri() . '/js/collapse.min.js', array(), null, false);
wp_register_script('alpinejs-focus', get_template_directory_uri() . '/js/focus.min.js', array(), null, false);
wp_register_script('alpinejs-intersect', get_template_directory_uri() . '/js/intersect.min.js', array(), null, false);
wp_register_script('alpinejs-mask', get_template_directory_uri() . '/js/mask.min.js', array(), null, false);
}
add_action('wp_enqueue_scripts', 'enqueue_alpinejs_and_plugins');
function add_defer_attribute($tag, $handle) {
// Elenco degli handle degli script a cui vuoi aggiungere l'attributo defer
$scripts_to_defer = array(
'alpinejs-morph',
'alpinejs-persist',
'alpinejs-collapse',
'alpinejs-focus',
'alpinejs-intersect',
'alpinejs-mask',
'alpinejs'
);
}
add_filter('script_loader_tag', 'add_defer_attribute', 10, 2);
This is 100% working and in a proper way. Idk if you can archive this with including with esbuild (not yet used)
Oh i forget the most important thing!!
Theme update mode, immagine we have a theme delivered to a client, we made changes in local and we need to push it as an update. Its really usefull!
In this way we can enrich starter wordpress theme with most crucial things included.
And i think its a big big hand from some one who is starting to develpe a theme with tailwind.
This is not a cheap talking or throwing things with links, this i guess how in 75% theme gonna be extened. So why not including it by default?
Just suggestions.
Thank you so much and have a great week!
Greetings
Richard.
Beta Was this translation helpful? Give feedback.
All reactions