Okay, maybe this is more of a “random thought while I take a break from work” than anything else. I’m adding the feature request tag so Team Pinegrow can noodle on it as well.
I’m working on a project where I can’t use frameworks like Tailwind or Bootstrap, and it’s reminding me of how much I hate managing and organizing CSS. I’d normally use Sass to help with this, but since I want to use the Pinegrow WordPress Plugin, that isn’t an option at the moment. Even with Sass, though, all those partials start to get unwieldy after a few pages of unique components.
I would love to see Pinegrow give us some tools to manage my CSS better.
So here are my thoughts…
- Style panel states: I love how the style panel lets me see what styles are being applied to my elements, but it doesn’t do a great job of showing me the styles that apply in different states unless I have those states activated. I would love, for example, to just click on an anchor element and see all the rules that apply to it regardless of state. (Hover, focus, visited, active, etc.) without having to hunt them down or click the “show selected element in ___ state” buttons for each individual element. I think the WordPress plugin version of Pinegrow behaves this way by default, so I would love to see it added to Pinegrow Desktop.
- Organizing rules: I’m not sure how this would look or behave, but I find myself keeping my code viewer open simply to move around my CSS rules. Pinegrow seems to have some smarts to keep things like breakpoints and state rules close to the vanilla rules, but it otherwise simply adds new rules to the bottom of your stylesheet. That’s fine, but I want more! I’d love to have a high-level list or tree or something where I can see all my rules and re-order them by dragging and dropping without having to sort through hundreds of lines of code to find that one misplaced rule. (There is always that one rogue menu rule in the middle of a sea of other components, for example). Again, I have no idea how this would work, especially since everyone has their own systems with @imports, Sass partials, etc.
- Managing breakpoints: Working with Tailwind has spoiled me since I can see at a glance what my breakpoints are doing. With the CSS style panel, that’s a bit more difficult. From what I can tell, I only see the breakpoint rules that apply to my current view, so unless I am looking at my CSS file, I have no way of knowing at a glance what happens at other breakpoints. Similar to #1 above, I’d love an option to see all the breakpoints for the selected element, even if they aren’t in use.
- Breakpoints at a glance: It would be helpful if the CSS visual editor “easy media queries” labels bolded the breakpoints that have rules. This would bring the CSS tools in line with the way Tailwind works and is helpful to see what’s going on at a glance
- Reordering rules: Wouldn’t it be nice to be able to re-order your properties via drag and drop instead of having to do it inside the editor? Yes, I know I’m just being needy!
- Move lines up/down inside the quick editor: This isn’t just CSS related, but I’m thinking of it now because I can’t use the ALT + Arrow keys to move lines up and down in the quick editor the same way I can with the main Monaco editor or VS Code.
- Move rules via drag & drop: Sometimes, I mistakenly add properties to the element instead of the rules. I’d love to be able to drag and drop those properties to the right places rather than having to re-write them or click again.
- Move rules between files: Want to keep your CSS organized with multiple files? I do! I also get distracted and create rules in the wrong files by mistake. Rather than having to copy/paste them using the code editor it would be nice to be able to right click on it and “send” it to a different file.
So what are your tricks for wrangling CSS? Or, if you don’t have any tricks, what things do you struggle with?
FYI: Principles of writing consistent, idiomatic CSS. (github.com) is a fantastic reference if you write messy CSS like me and want to start getting it under control.