[Helpful Hint] make:addon artisan command for theme has issues - use with caution
Created 6 years ago by emergingdzns

I've been putting together a few themes for client sites and I keep running into issues and I finally have a moment to write this all down. This is all hopefully to save other devs time in the future when creating new themes.

To get started on a new theme, I would typically run php artisan make:addon and give it my namespace.theme.name string. It then creates a very odd skeleton of a theme which I think is probably a bit out-dated.

First off, it puts the jquery.min.js and bootstrap.min.js in the resources/js/vendors folder. But the vendors folder isn't under repo using git. So if you use a deploy script that runs off of your git master commits, the javascript will fail because jquery and bootstrap files are not getting added. To my knowledge there's no composer-like (ahem Bower) being used in Pyro, so that vendor folder might as well be imaginary. It took a while to figure out that this was happening so hopefully this will same someone hours. Just move them up a level to the js folder and modify the assets.twig file to match.

Secondly, the scss is REALLY slow. So slow my browser times out. I can't just load the home page with nothing on it even. It's a dog. I totally understand WHY this is being used and that it can be very handy but so far it has just proven to be a major pain in the butt. If you remove the ["live"] or ["min"] from the script inline function and it speeds up dramatically. Far better to simply configure your bootstrap elements in a non-minified bootstrap file and put them in a regular css folder and include them in the page.

Last, it seems like there's an odd version dichotomy here too because the skeleton of the theme that is created uses a very old version of jquery, and the older bootstrap 3.3.7. But then if you attempt to do pagination in any theme or module files, the pagination twig that is used comes from the accelerant theme and is bootstrap 4 based.

So, my latest strategy now is to use the artisan command to scaffold it up but then I remove most all of the files from the resources folder and plug in my own, newer ones. The views I'll keep but modify to my needs and new files.

william  —  6 years ago
ryanthompson  —  6 years ago

One of the many things on my plate is improving the scaffolding for themes to include webpack and more better defaults 😄

Contributions welcome but thanks for the feedback! Noted.