-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
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
[Proposal] Simplify css and js options? #518
Comments
Unifying sounds like a good idea! As long as users can still specify both common files that are used on all pages, and specific files that are used on individual pages |
Asking for comment before CSS changes finalise. CSS related settings would be split across From users' perspective, sample config for layout and pages look like the following for now:
|
variable | note |
---|---|
layout.common-css |
Global CSS used by all layouts |
layout.css |
CSS used by some layouts only |
page.css |
Per-page CSS |
site.css.main |
Theme CSS (/css/main.css ), can override everything above |
One point still unsure of: whether an entry point should be provided for user (such as site.css.customize
) to override any style, or simply tell users to change main.css
directly. The rationale is, when theme style sheet updates from time to time, it may introduce conflict with user customized changes. Merging changes manually is no fun and can be error prone. It would be cleaner to SASS-ize the whole thing so that styles become parameterised and more configurable, but that's a whole new level of commitment.
@VincentTam Wish to ask, would you mind if I move Staticman related CSS and JS around, so they become more integrated into the reorganisation idea above? I'm working on CSS for now, javascript changes would be pending later. |
@abelcheung Please feel free to move the CSS & JS files in the way that you think the best. In this theme, Staticman is only rendered (if enabled) in posts, not in pages. Looking back, in the Staticman integration (ported from Minimal Mistakes), I'm not really satisfied with the mixing of JavaScript and Jekyll logic. A better approach would be to load the data from the HTML tags in the Jekyll-HTML template. As I prefer Hugo for its speed, I wonder if one can create CSS resources from template in Jekyll. But I probably won't need this, because UI text can be stuffed into hidden HTML tags.
P.S. Thanks for your PR that corrected the jQuery path in the JS code for Staticman. |
@VincentTam I'm not sure if this is what you mean, but you can use some templating in CSS, see here for example: Lines 15 to 18 in 94161db
|
@abelcheung I personally think that leaving main.css untouched and users adding their own css files is the cleaner solution, from a similar reason to what you said. That's why I wanted there to be a |
@daattali Thanks for your answer. That's exactly what I'm looking for. However, I would try to avoid this and include Staticman's UI text into the HTML template instead of CSS if possible, since the later is mainly for style. |
@daattali It's the inclusion order. To guarantee theme CSS and user customized CSS work as intended, they have to be included as second-to-last and last one respectively, regardless of how layouts are included. So I'm thinking of pulling them out of front matter variables and treating them specially. |
@VincentTam What you want is possible as @daattali has noted. Actually my plan is to convert |
@abelcheung Thank you all for your suggestions. However, I will submit a PR with a pure JS solution two weeks later, without mixing Jekyll and JavaScript/CSS, like what I've done in Hugo's Huginn theme, so that the UI text are loaded to the HTML. That enables portability of the script towards any static blog generators. |
@VincentTam sounds good @abelcheung Are there instances right now where the inclusion order is wrong? |
@VincentTam That's great, then I'll take care of other javascripts first for now. @daattali Luckily, not yet. Just that I want to be foolproof and deal with foreseeable problem as early as possible.
If the last entry does not exist, then And that would add extra variable to site config, so my question is: are you ok for this addition? |
It's been years since I touched the css framework, frankly one reason is because I took so much care to set it up properly that I've been scared of breaking it! I initially thought your idea was to combine What I realize now you're suggesting is a bit more complex, so I'd have to see the changes in a PR to be able to judge. It's hard for me to picture it right now because I don't know how the current system works anymore |
@daattali Put it simply, it's config variable combining (as you have stated), plus forcefully moving |
@abelcheung @daattali After reading this article about form action URL, it seems that removing the form action URL ( By the time I write this message, in #521 at commit 922c35a, # assets/js/staticman.js
var endpoint = '{{ .endpoint | default "https://staticman-frama.herokuapp.com" }}';
var gitProvider = '{{ .gitprovider }}';
var repo = '{{ .repo }}';
var branch = '{{ .branch }}';
$.ajax({
type: $(this).attr('method'),
url: endpoint + '/v3/entry/' + gitProvider + '/' + repo + '/' + branch + '/comments',
data: $(this).serialize(),
contentType: 'application/x-www-form-urlencoded',
...
}); The goal for this upcoming change is in line with that of #509—to stop spam bots from abusing Staticman users. P.S. I'm sorry that I've to eat my words the 3rd time in this project. Previous words eaten:
|
Is this a concern that you've observed in practice? |
Also, is your comment directly related to this issue? Sorry if it is, it's getting hard to track all the different issues/PRs, as this is only one of many projects I (try to!) manage :) |
@daattali Sorry it's not directly related. Looking back, I should have put most of them in #521. Since my previous comment, contradicts another comment that I had made: #518 (comment), I've to give a word to you and @abelcheung about the motivation behind such changes, even though I'm not quite sure about its effect against spam comments in https://github.com/hashtafak/hashtafak.github.io/commits/master. I should have left the details in the PR instead of here. |
Sounds good. @abelcheung let me know when you've continued with the PR! |
@abelcheung if you ever want to return to this PR to simplify css/javascript, it would be very welcomed! |
One of your suggestions of removing |
For a new user it is hard to understand, what is the best way to add own CSS not changing the delivered main.css Some instructions on https://github.com/daattali/beautiful-jekyll would make it much easier. So what I understand what to do, some instruction like this are required:
or there could be an empty custom.css included in the project and it could be already added to the base.html, and it could contain some comments. If I did not right understand how to use this system then it will be even more important to give some hints. |
I explicitly don't want to add such advanced instructions. If I provide these instructions, more people will assume that doing such techniques is within the scope of what I need to teach them, and there's already enough support that I'm being asked for daily. If someone knows about CSS, then they have the skills required to understand how to change or add a new CSS file. I want this theme to remain basic and accessible for everyone, which means that it doesn't get into all the more advanced things - anyone who wants to do that is free to read the jekyll documentation and learn on their own. But this theme's goal is not that, and I don't want to give that impression. For context, when this theme started it was very basic and had one simple goal, to provide a theme that any lay person can use - focus on ease of use, not flexibility. Over time people kept asking for more and more advanced instructions and options and I agreed to them all. But that also meant that more emails kept pouring in because people expected these parts to be supported. So I learned that I have to be more strict about where I draw the line between what this theme supports (everything in the config file and readme) and what it doesn't (anything else). I'm leaving this issue open because simplifying the css and js internally is still a valuable thing to do. |
I get your point. maybe #401 could be a solution? A place where users can ask each other? |
@aisbergde there is a |
Regarding the original issue by @abelcheung : I think Same goes for js |
Closing this issue because after almost 4 years it's still unimplemented and I frankly don't think it's too important. The current system works, this cleanup job is becoming increasingly more dangerous with time as there are more and more users. |
Currently there are multiple variable names associated with CSS usage:
common-css
andcommon-ext-css
under layoutcss
andext-css
under pagelayout.common-googlefonts
andpage.googlefonts
are also CSS, only saving a few keystrokesWould it be useful to just unify them altogether and have a single
css
variable exposed under layouts and pages?The same applies to javascript too, not just CSS. But javascript may need extra consideration though, as dependency problem and double inclusion problem affects user experience more than CSS do. As currently hand-coded loading order is used, it might be necessary to educate users not to mess with the order without careful consideration. 🤷♂️
The text was updated successfully, but these errors were encountered: