-
Posts
768 -
Joined
-
Last visited
-
Days Won
34
Everything posted by Jonathan Lahijani
-
[SOLVED] RockPageBuilder .block class collides with tailwind
Jonathan Lahijani replied to dotnetic's topic in RockPageBuilder
For Flowbite's Javascript file, I just load that file manually. For CSS, I didn't realize they have a ready-to-go CSS file as well, but that seems kind of pointless since Tailwind (similar to UIkit and Bootstrap) would require a build process for it to be customizable. I simply use Tailwind CLI directly (without NPM). But as you mentioned, given the nature of how Tailwind works whereby it will only include classes if they are used, it makes using it for a page builder more complicated unless you safelist a bunch of classes. As far as not being able to use Flowbite for end products, yea that's a downside. But I don't think there's a problem configuring a page builder / RPB with blocks for a specific client and not general use. I'm preferring it over UIkit these days because doing CSS using pure utility classes has won me over as opposed to a mix of utility classes/separation of concerns (UIkit, Bootstrap) vs. pure separation of concerns. For example, I like that I can copy a block from Flowbite without any thought of it not working or having other styles in the cascade affect it, but at the same time having full flexibility to change it easily. Tailwind also just makes more sense for designs where you have to "color outside the lines" of a CSS framework like UIkit. It's horrific to look at all those classes when using it initially, but then you get used to it. -
[SOLVED] RockPageBuilder .block class collides with tailwind
Jonathan Lahijani replied to dotnetic's topic in RockPageBuilder
If you dabble in Tailwind some more, I strongly recommend using Flowbite, which is still pure Tailwind but with an added JS library that makes it more batteries included like UIkit and Bootstrap. Also there are free and premium blocks and layouts which I've purchased that speeds things up considerably while maintaining the flexibility of Tailwind. To me, it's the winner of the all the various Tailwind competing user interface kits (ie compared to Preline, Tailwind UI, Daisy UI, etc.). -
Hi @ryan, Thanks for this update. One easy to overlook but important missing part of the repeater update that was made is what happens if you edit a repeater item directly. Assume we have a repeater field named 'books' and you edit the repeater item page by going to /admin/repeaters/books/(for-page)/repeater-item-page When editing it directly, the page to be edited simply gets the RepeaterPage class instead of BooksRepeaterPage class. I managed to hack-fix this by doing this in /wire/core/Templates.php: // determine if custom class available (3.0.152+) if($usePageClasses) { // generate a CamelCase name + 'Page' from template name, i.e. 'blog-post' => 'BlogPostPage' $className = ucwords(str_replace(array('-', '_', '.'), ' ', $template->name)); // *** *** hack fix: if we are editing a page with a template that starts with 'repeater_', assign the correct page class! *** *** if(str_starts_with($template->name, 'repeater_')) { $className = __NAMESPACE__ . "\\" . str_replace(' ', '', $className) . 'RepeaterPage'; $className = str_replace('ProcessWire\Repeater', 'ProcessWire\\', $className); } else { $className = __NAMESPACE__ . "\\" . str_replace(' ', '', $className) . 'Page'; } if(class_exists($className) && wireInstanceOf($className, $corePageClass)) { $pageClass = $className; } } Can what I described be supported as well?
-
Pastefilter from TinyMCE removes everything
Jonathan Lahijani replied to drem's topic in General Support
This is a known issue. I actually made a big report in the PW issues repository on GitHub. -
After over 10 years, I didn't know you can simply give a page's name when assigning a value to a page field. I discovered this by accident. I used to do this: $page->setAndSave('order_status', $pages->get('/path/to/order-statuses/pending/')); But I realized you can simply do this in ProcessWire making it much easier on the eyes, with the added benefit of not having to update the code if the path to the page changes: $page->setAndSave('order_status', 'pending'); My mind is blown. It makes me wonder what other little things I haven't realized yet.
-
ProcessWire Weekly - Milestone achieved: 500 issues!!!
Jonathan Lahijani replied to BrendonKoz's topic in Pub
Hah. I do the same for the processwire-dev branch using Zapier. Near instant notifications when commits are made. Living on the cutting edge. -
I originally thought the issue you mentioned was the same issue I was having, but it turns out I was using my selector incorrectly.
-
@MarkE Were you able to get this working?
-
I'm trying to add a markup field to a repeater item. I would think to use ProcessPageEdit::buildFormContent however that only executes when a page being edited is loaded, not when a repeater item is expanded. What is the correct hook that would allow me to use the form API and insert a markup field somewhere in the repeater item?
-
Caddy - a lightweight HTTP2 web server
Jonathan Lahijani replied to gurkendoktor's topic in Dev Talk
I've been using Apache forever... never even touched nginx. Today I felt like giving Caddy a try and it feels nice. I developed what I believe is a much more improved Caddyfile that also supports ProCache and stronger blocking of files (returns a 403 like PW's htaccess file, instead of a 404 which is what /denyaccess seems to do). I added a way to also put the site in maintenance mode (meaning all requests get rewritten to /maintenance.php) if /maintenance.php exists (which is now part of my deployment process). Hopefully I can share the results in a week. -
Displaying thousands of records
Jonathan Lahijani replied to michelangelo's topic in General Support
Somewhat related, but cursor-based pagination would be useful for sites with large amounts of data (especially if it's being queried on the API-side). I put in a request to see if this can be a native feature: https://github.com/processwire/processwire-requests/issues/511 -
I love ChatGPT when it comes to doing weird things in JavaScript. For example, there's a 3rd party service a client of mine is using that allows you to load in custom JS and CSS to customize the appearance of their platform more to your liking. The HTML of the 3rd party service is lacking in some CSS classes on some elements, so I can't hook into those elements to style them more precisely. To further complicate things, those elements only appear after an AJAX request is done. So I needed to add extra classes on particular elements in the HTML every time an AJAX request was made. I don't keep up with JS, but after giving it a nice prompt, BOOM, there's the answer with MutationObserver, XMLHttpRequest and addEventListener. This literally saved me a day, if not more, and tons of headache.
-
ProcessWire stores the users in /admin/access/users/. This means if you want to view the user list in the page tree, you have to click into it and that's not ideal. It would be better if the Users were just presented as if they were nested under the Home page. Approach 1: actually move Users under Home (avoid this; explanation) While I haven't tried it (and have no plans to), you could do what Ryan described in this article a long time ago, this but it's probably dangerous and overkill: https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-templates-or-parents-for-users Approach 2: fake it! (better and very easy) What would be better for some is to have it appear as if the Users were directly under the home page, but without actually having to move the Users page itself as it could break ProcessWire functionality. This can be accomplished easily with the following hook (add this to /site/templates/admin.php): // make Users appear as nested under Home page $wire->addHookAfter('ProcessPageList::find', function(HookEvent $event) { if($event->arguments('page')->id!=1) return; $event->return = $event->return->prepend(wire('pages')->get('/admin/access/users/,include=all')); });
-
- 3
-
-
I need to develop a RESTful API in ProcessWire. While I haven't developed one before, I am fairly comfortable with the general idea. There are separate PHP frameworks that specialize in this, as well as specific ProcessWire modules, however I want to do this purely with ProcessWire. I haven't seen discussion on this, but my thinking is the necessary features are there to make this happen, which are: url hooks https://processwire.com/blog/posts/pw-3.0.173/ $input->requestMethod https://processwire.com/api/ref/wire-input/request-method/ $config->sessionAllow (I should disable sessions probably to example.com/api/*) https://github.com/processwire/processwire/blob/master/wire/config.php#L375 one of these authentication methods https://blog.restcase.com/4-most-used-rest-api-authentication-methods/ Any thoughts on this or recommendations?
-
PW 3.0.228 – Core updates and Pro module updates
Jonathan Lahijani replied to ryan's topic in News & Announcements
Hi Ryan, Would it be possible to create a more streamlined way for your 1st party commercial modules to be downloaded? I have licenses for most of them and grabbing them all one-by-one through the respective forum threads is less than ideal. Too much friction. Ideally, if they could be upgraded via ProcessWireUpgrades module (although I think I understand your hesitation doing it that way), or if there were some sort central control panel on processwire.com/talk/ (or just processwire.com), that would be a nice upgrade. -
I remember using Textpattern way back in 2005 or 2006. I'm old (by web developer standards).
-
My use of Node was as follows (well it was based on Laravel Mix): downloading packages (package.json / node_modules); for example, getting UIkit, jQuery and whatever else a project required compiling SCSS or Tailwind creating a dist folder with that CSS, other compiled JS and images cache busting As for downloading packages, I have my own ProcessWire module that contains unminified and minified versions of the packages I commonly use or that I deem to be worthy enough to be in the module. I built a very simple way to update those packages and include them in my project as well as well. UIkit is a special case in that it's both SCSS and JS files. If I want to include HTMX for example, I just do this: setting('htmx-enabled', true); and everything gets inserted as it should. The potential drawback of this approach is that because I use this module across many different projects, all projects automatically get upgraded to the latest version of a package which could potentially break things, but that's rare and not a big issue for me. For compiling SCSS, I would have stuck with ProCache (SCSSPHP) but it's completely outdated and that's just not going to change. Therefore I use DartSass. You can download the executables here: https://github.com/sass/dart-sass/releases I've hacked ProCache (because it doesn't have the necessary hooks) so that instead of using SCSSPHP, it uses DartSass. Ryan has expressed the ability for ProCache to be more friendly to using outside compilers so hopefully a future version of ProCache doesn't have to be hacked directly. As for Tailwind, during dev I use Tailwind Play CDN. During production, similar to DartSass, I use TailwindCSS CLI and I hacked ProCache to make it work with it as well: https://tailwindcss.com/blog/standalone-cli https://github.com/tailwindlabs/tailwindcss/releases/tag/v3.3.3 Both DartSass and TailwindCSS CLI have minifiers built-in, so therefore I avoid using ProCache's CSS minifier which has been a a little buggy (although I think it's now fixed?). Technically speaking, TailwindCSS CLI is Node.js under the hood, but it's wrapped up into one executable which feels clean. For what would typically be a "dist" folder, I just avoid that. ProCache Buster handles that in its own way. Yea these is how I think about it as well. HTMX is less opinionated and I like it that way. However HTMX is not the "JS sprinkles" (it's more for HTML over the wire requests) so that's where Alpine.JS comes in.
-
That's pretty much the main reason. It would require me to use ProcessWire in a different way and I don't buy into that approach, especially with HTML Over The Wire (for example, htmx) giving me all the benefits of heavy JS-frontends without having to use them. Server-side rendering all the way. I've completely eliminated Node from my workflow and it feels great.
-
I've heard of Astro and a bunch of other JS heavy frontend frameworks where ProcessWire has to become an API for it to work. Hard pass for me for so many reasons. This article is exactly what I was looking for. Thank you for sharing it! It seems nesting is available on all the latest browsers, but I'd worry about people on old versions of Safari due to being on old versions of macOS (Macs seems to last a while), so yea I agree with using a build process for now if nesting is critical to the way you write CSS, which it is for me as well. Also, doing breakpoints in SCSS in much more intuitive than vanilla CSS.
-
@ryan Can ProCache be refactored in such a way that SCSSPHP and the other compilers are optional extensions, along with the ability to define our own compilers (ie, DartSass and TailwindCSS CLI)? You mentioned something along those lines in a conversation we had in the ProCache forum and I think this would be a step in the right direction given how fast things in frontend web development move.
-
Given that CSS has made huge strides in recent years combined with my desire to remove build processes (Sass, Tailwind), I'm thinking about going back to writing vanilla CSS, at least for some projects. My question is, what CSS organization methodology makes the most sense for vanilla CSS? I was never a fan of BEM personally and haven't had to think deeply about CSS methodologies for the past 10 years because I just followed the style of whatever CSS framework I was using.
-
ChatGPT has blown my mind countless times from a programming point of view. It's ridiculously helpful and has given me superpowers (ie, less reliance on poor Google results, which in turn helps with learning faster). It's also very helpful in providing a starting point on topics I have low experience in (for example, doing some advanced things with ImageMagick). My prompt was literally copy/paste of my original post. Pretend ChatGPT is a human that knows basically everything about everything. I have a bunch of other code in ready() which was causing errors given the context. But I should investigate that further (I was losing patience debugging for 2 hours). Will try what Ryan mentioned, but for now I refactored my hooks into their own method.
-
It's nice to see a ProcessWire site that's close to home!