-
-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v3 theming proposal #441
Comments
I agree theming is a huge topic which needs to be addressed in v3. I know how the theming works and yet I still make "hacky" changes to get custom themes to work because it easier. I think your suggestion of making a central directory is something we should look into. Currently SUI/FUI provide 23 different themes (including default) which is madness and especially when they don't even get updates so maybe in v3 we drop all these and just support one theme in the core library. |
Nice to start discussing about that. Here are my first thoughts about that.
That's just quick thought/ideas I had after seeing this threads, I'll think more about how we could improve the theming system. |
@etshy I agree with a lot of your points. About your |
Maybe make another class if we want another them for a component only then, right ? A theme should be for the entire website, and we can make a And I thought about putting it in the |
@etshy I think we will include a full copy of normalize.css in v3 which will mean you wont need to do that. |
I never used normalize.css yet, but if it helps that's good to include it. Another question, do FUI keep less ? I saw that bootstrap4 changed for less to Sass, mostly for the theming part. |
@etshy We (FUI team) did have a slight chat about being able to switch to SASS if these theming changes go forward 👀 |
Ok so I have been messing around with a possible repository structure and have thought about this theming quite a bit so I will try and explain what I think will work or a possible starting point which we can build on. So in v3 we are changing to a monorepo with all the components in separate packages which will make it difficult to change variables etc. Now currently SUI/FUI puts its whole src directory and dist files into your project and this is a large directory and kind of pointless if your not theming it so my first thought is why do we need to move these files in the first place? For a quick example I will show a small structure of a few components.
So Now for the theming, I think we could make a package called @import '~@fomantic/button/_variables.scss'
@import 'fomantic/default/elements/button.scss'
@import '~@fomantic/button/button.scss'
What this will essentially do is import the button variables file and then override them variables with any custom user variables and then import the button SASS code which uses them variables. So for a simple overview this is what your project would look like
This means no more large directories with all the source code and only files for components you are theming. Give me your thoughts and suggestions! |
This seems good. About variables files, it will be one file per component/modul only, or will we have also a global file (to choose colors, border settings or others things that could be global) ? And these variables could still be overrides in the component/module variables file, I guess. I like a lot the fact to keep the theme directory. With that we could make an easy way to change them by changing the url part with theme name 👍 For the Maybe you should include the "theme" word in it, something like So in your example, in Not thats it's really important, just a question that came. Also what's the point of the |
@etshy I was messing around last night with a quick prototype I put together to see if this concept works in reality and it was good news 🎉
From making the prototype I can see that the variable files will need to be kind of how they are now so a separate file for each component so you would have a Doing a method like this would also allow users to potentially extend custom themes so say you have the FUI default theme and you also have a theme downloaded from NPM for your button you could make your own @import "~custom-fomantic-ui-button-theme";
$borderRadius: 2em; This would allow for "extending" of themes which is how theming is setup right now in SUI/FUI. This could be really useful for a dark theme for example. Install a dark theme from NPM and you can easily change the color to your liking.
Now for changing themes easily I think we should investigate adding a
So once theming is enabled it will create a
The |
The part about extending themes and all seems very interesting. Like you said, it could allow to create theme packages and easily use theme in a theme and the scope thing could ease that too.
Afther thinking about it, I'm not sure having multiple themes in one file is good. Imagine a site that have like 5 or more themes, will you load the css for all the themes ? |
@etshy I'm sure we can add an option to the config to enable/disable the theme bundling 😉 |
Didn't event think about an option in the build command ... |
@etshy Do you not think it would get a little messy with lots of files for each theme
Just think for all components and multiple themes. I think they should go inside a directory like this
|
Hmm I thought about building the whole src and theme files into one theme file.
You only load one of those file, as there is everything in it (global and theme CSS rules). |
@etshy We are going to keep the dist how it is now (FUI team have already discussed this) because lots of users like to include only the files they need. You might have all components because you use them all but you might only need to menu, form and grid components on a contact page so you only include those files and then your not including a large CSS file for all the components which you don't need but you might use them on other pages. Again we could always figure out a way to customize the distribution format in the build tool. |
I guess yeah. To prevent having too much files to load, should we think about a way to make bundle files then? something like that
Like that we coud make "page-specific" files.
but maybe that's more a work for a bundler like webpack ? 🤔 Also about your latest dist representation, If we have a folder for the theme I don't think including the theme_name in the filename is necessary. It's a little detail, though |
Whats the plan of V3 launch. |
@crewow We are still in the planning and proposal phase so there is no set date for a release right now. Depending on how large the v3 scope becomes will determine on how long it will take. |
I was looking at other CSS frameworks a while ago I came across mini.css. One thing I thought they did really well was allowing users to set variables with They also have a theme builder on their site, but that's a little more involved. |
@GammaGames That's a cool idea and I may look into that. If we decide to do this I don't think we should do it for the first release of v3 because it would add a lot to the scope. |
@prudho In fact the company I'm working for needs this three layers! Here is why:
Now let's imagine you have one standard theme and six projects which are based on that theme. After a while you find some bugs in your standard theme and all six projects are affected. If you don't have this second (theme) layer you have to fix the bugs in all of these six project-repositories repetitive. You don't want that! You wan't to fix the bug only once and update the dependencies in your (six) projects. MAYBE you have to patch some of your projects a little bit more because you did some advanced stuff with your theme but that's okay, because your customer paid for it. But what if you WANT to make your next huge project from the scratch? You just want to 'skip' the theme layer. Well you just take a But without that theme layer you CAN'T reuse your work except you copy your theme again and again with all the drawbacks. Regarding that
The example above is only able to produce a single output so out put splitting is not possible. We don't use Gulp and I think this would be also important. Everybody should decide on it's own if he/she want's to use some thing like Gulp or not; therefore we build our own tool-chain.
I totally agree to get it more simpler and LEANER. BUT I don not agree, if I have to pasting a whole theme or a lot of code into one project after another! I think it's very important that I'm always able to reuse work WITHOUT copying it over and over again.
I agree with: no more
Yes you are right about the customization and to make it simple for simple use case. You might be not right about the number of 0.5 %. And I think it's important to provide a scalable product!
Thanks for your thoughts! 👍 EDIT: Just to be clear: What I vote for is an extreme lean project/site structure what does reuse as much as possible WITHOUT being complicated. In fact we already have such a (VanillaJS) tool chain in production but unfortunately we don't have the time to publish it and we are currently not able to split, which is an important feature I think. |
I want to second what @witrin says here. My workflow is also relying heavily on the 3 theming layers in SUI, in a very similar way. I maintain a base CMS install and use a theme to make sure all the output is decent enough by default. Then each install has a few options for tweaking colors, fonts, etc and adding a logo. Basically these are all small adjustments in site.variables. Most of the time, this is good enough for small / low budget projects. And the beauty of it is that with the 'site' layer, we can quickly make changes or fix things on project level. And if it turns out to be a structural issue that affects the entire framework, we merge it into the theme. For bigger projects, we sometimes create individual themes. Again: reusability is what it's all about. We can create coherent layouts across multiple sites, with a few variations per project but all maintained from a central theme. For a brand with different product sites for example, we mostly work on the same theme and pattern library so in the end they don't pay much more than they would for maintaining a single site. I also introduced SUI to a software developer, so he can reuse his theme across different extras created for the same platform. Same for me personally. Before Semantic UI, I used to spend a lot of time on fiddling with CSS, but thanks to this theming structure, that has been slashed to maybe as little as 10% of what it was before. Sure, some of that time now goes to debugging stupid NPM issues and waiting for gulp build to complete (any improvements there are more than welcome), but overall it has been a giant leap forward in productivity for me. And I must say that the component.variable and component.override files also helped me there in deciding where to put the custom CSS and later in retrieving it again. It takes some getting used to, but in the end it makes sense to do this per component. Also being able (and encouraged) to use straight up CSS here instead of having to learn language- or framework-specific syntax is a big plus. This could also make a possible transition to something like native CSS variables or PostCSS more doable in the future. So to conclude: the current theming layers are essential to me as well. I am considering to switch to the Fomantic UI fork and would love to help this project forward (as I'm painfully aware of the current state of the mothership) but simplifying the theming structure would make that impossible for me. That's not to say there's nothing to improve on the current theming system of course! Some things are already mentioned, but from the top of my mind:
In any case: I think care should be taken when overhauling the current theming system. Please don't judge it as messy or complicated too quickly; it might appear that way if you're mostly working on a project level, but in terms of scalability and reusability it makes a lot of sense to have these 3 layers in place. I'm pretty sure Jack Lukic has put a lot of thought into it and as you can see, there are users out there that rely on this structure ;) In any case 2: thank you for taking the initiative to turn SUI into a community-driven project. I was very relieved when I found out about it and hope it will turn out to be a success. Thanks also to @witrin for your clearly written issue. Can go straight into the theming FAQ! |
@witrin @hugopeek Don't worry we aren't removing the 3 layer ability, I am currently prototyping this exact thing right now and I am actually trying to figure out how to implement it so you can have infinite levels of themes so theoretically you could extend a theme from another theme with the first theme extending from the default variables. A lot of the points you both talk about I agree with and we will try our best to address them. The problems with the build system should be addressed in v3 because it should have a completely new build process which should allow for more flexibility. |
Hi @hammy2899, I'm glad to hear that. So you're building a theme, within a theme, within a theme huh... Good luck; don't go too deep! ;) Getting more and more warm fuzzies from this project, so I'm porting some sites over to FUI now to take it for a spin. |
Oh, Oh! I know, senpai! Constructable Style Sheets. Use JS template literals--no need for LESS/SASS. Wrap it in a JS Class and then extend infinitely. You can apply them to shadow DOMs, so each component on a page can be using a different theme. People might not even freak out completely at this idea... in 3 more years. :) Call it my FUI v5 Theme proposal. |
I agree with what @witrin @hugopeek say - also coming from a perspective of architecting a reusable UI framework for my company (with an expected lifetime of about 20 years). I'm currently evaluating if we're going to implement Se/Fomantic as an abstraction layer for the look and feel exactly due the possibilities it offers in regards to theming. The current theme engine might not be 100% satisfactionally for many people and requires breaking your head around it a bit, especially if you're not familiar with the idea of abstraction in itself but Semantic is about the only one do do it even halfwhat correct (to my knowdlege, correct me if I'm wrong). It's a standalone feature that attracts those that know how to use it. I would be very careful in how you "rework" it, also in conjuction with Gulp and the whole build process. There are a plethora of "UI Frameworks" like Materialize that have their own - very specific - look embedded within their body that are as "lean" and "flexible" as a brick. If you want a "simple" thing, I wouldn't reinvent the wheel by breaking another one in the process. I also disagree with the suggestion by @avickers - mixing Stylesheets and Javascript for layout purposes is just a mess. Languages like LESS/SASS were invented for very good reasons. Javascript in itself is already a mess (yes even with all the advancements it has made in the last 4 years) - and can change in any minute and completely break your layout (Google is very good with that nowadays, I mean breaking stuff globally - just ask Mozialla employees). Adjusting to that with a transpiled language like LESS/SASS is way easier to be done than manual hacks like JS template literals for the "feel of leanness" and "reduced complexity". With LESS/SASS you just update the transpiler - (maybe adjust your build-script) - retranspile - done. |
Just chiming in with my support, also, for the 3-layer system that currently exist (as @thiscantbeserious @hugopeek and @witrin said). I don't think it's overly complicated. Variable overrides go in .variables, hard css customizations go in .overrides. There's room for improvement in the way some of the components are built (and documenting the variables somewhere), but overall I think it works. |
About theming...
I have opened this issue to talk about the actual state of theming, and how, in my opinion, we could improve it and simplify it at the same time.
The actual state...
... is a mess. The user have to define a
theme.config
file, then he can choose which pre-defined theme apply for each component, and to finish, he can edit.variable
and.override
files to fine-tune his site theme...I mean, who find that usefull and/or intuitive ? Who really want to use different theme for one component to another ? And what's the purpose of this override stuff ?
The future state of theming...
... needs to be more simple. FUI has only one "official" default theme which is located in
/src/theme
. If a user want to edit his website theme, he just have to edit thevariable
files stored in/src/site
then build the CSS. If he wants to apply a theme, I think that he just have to paste a theme package to his/src/site
folder then rebuild... That's it !No more
theme.less
file. No more useless.override
files ! And creating a theme-generator would be more simple too: you generate your theme package trough the generator, download it and paste it down in yoursite
folder, and you're done !Final notes
Like I already said, it's just my own opinion and vision... Maybe some users needs more customization options in their build system, but I don't think that this user base represent more than 0.5% of total FUI users.
So let's start discuss about it, folks !
The text was updated successfully, but these errors were encountered: