-
Notifications
You must be signed in to change notification settings - Fork 5k
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
CSS Preprocessing #216
Comments
Should variables use-hyphens or camelCase? @linkHover: red;
/* or */
@link-hover: red; Also applies to namespacing, which less only offers support for in nested rules. I ask because bootstrap had an issue where about half of the variables were camel and the other half hyphenated. |
@brigand , CamelCase is better and more readable as it's so close to the Javascript style "We are JS lovers!" |
@layoutDirection will be a LESS variable that has |
@brigand With regards to camel case, dashed case. I think both have their arguments. Camelcase means that we can immediately recognize LESS variables as being different than css, since for semantic we're using lower case dashed words for css classes. Alternatively using dashed case for variables means that it will fit in to the style of the rest of the code because everything else would be dashed words as well. |
@jlukic personally I prefer camel, but it really doesn't matter. There just needs to be one documented correct way; and pull requests that use the other should be rejected. |
So this has gone full circle. After spending the afternoon experimenting I realize that real loops are not and will not be available in LESS See the creators comments So i guess we either have to remove loops and create variables like @color1 @color1hex or we can use SCSS. My buck is on swapping to SCSS/Compass. It looks like there's a lot of support, and honestly if we just use the good parts we can keep the preprocessing stuff simple so we can make adjustments in the future if we need to. Control directives like each loops are pretty simple in SCSS |
SCSS doesn't have a JavaScript port, so we wouldn't be able to use it in the browser. |
@brigand in that case, what about a "Preview/Edit on CodePen" button or something? (instead of generating previews ourselves) EDIT: see http://blog.codepen.io/documentation/features/can-i-pre-fill-codepen-editors-with-code-i-send/ |
LESS would make the build tools much easier, since there is a direct javascript port for less. It would also make an inpage customizer with preview pretty badass for UI definitions. BUT man do i hate some of the syntax LESS loop (Requires color Count, variables declared separately, insanely retarded esoteric mixin syntax) .createColor (@index,@selector) when (@index > 0) {
@class: ~'.ui.@{color@{index}}@{selector}';
@colorHex: ~'@{colorHex@{index}}';
@{class} {
color: @colorHex;
}
.createColor(@index - 1, @selector);
}
.createColor (0, @_) {} SCSS loop @for $index from 1 through length($colors) {
$color: nth($colors, $index);
$colorHex: nth($colorHex, $index);
.ui.#{$color}.button {
color: $colorHex;
}
} |
@Pym we're building a zip file so I don't think that really works. We'd have to set up a server, and depending on use it'd probably be about $15/mo. It's not a terribly large amount of code to just write it out. Neither of those loops look good. this
or this:
How often are we really going to be changing the way colors work? |
@brigand as @jlukic, I prefer the SCSS loop :) But I still doesn't really know how much loops are used in Semantic-UI right now... Anyway, if you plan to build a zip, you'll have to compile either with LESS or SCSS. So, why not compile also for the preview? I mean, is a "live" preview really necessary? |
@Pym the builder works like this:
Everything would be fine with SCSS except for steps 4 and 5. There's no way to compile SCSS in the browser currently. |
Man looking at all these css preprocessors makes me want to write my own. They just seem like really lame versions of other templating languages with a few extra built-ins for understanding color manipulation. I kind of feel like compiling all our css with handlebars instead. It can be parsed in the browser, and everyone knows it really well already. Ideally the names of colors and other groups of variations should be user defined and have arbitrary length. colors: {
blue: '#2c72b3',
turquoise: '#2cb38b'
}
sizes: {
minute: '0.0001em',
small: '0.5em',
medium: '1em'
} So if i generate a palette i get to name my own colors and those colors are used throughout all UI elements with the names i've given them.
|
@jlukic that would kill portability of HTML. You should be able to change the stylesheet without losing styling. People can change gray to eggshell; but still call it gray. Yeah, CSS processors are somewhat lame. Go for it! |
@brigand I guess you're right. The issue though is most color palettes use similar colors. Just browse through Kuler I guess in English color names are a pretty arbitrary anyways, so perhaps getting too serious about them in the library could be a fairly frustrating and fruitless task. Maybe we should just limit the number of colors of elements to a reasonable amount and use ordinality. Primary - Strongest brand color
Then just migrate away from using named colors since they promote crazy rainbow sites anyways. |
One option is to use <div class="other blue ui button"></div> That's require a much more complicated system (or a ton of code), which LESS doesn't really provide. Maybe 2.0. |
Yeah, either way we're running into the same issue with loops not being great in LESS. I think for 1.0 lets just go with named colors
then
|
I'm going to use autoprefixer for vendor prefixes from Grunt. This way we can just use W3C values in |
LESS is popular than SCSS, it will helps growing up the community, the problem of LESS is in the syntax but it will serve the package more than SCSS (specially when talking about the package generator) I'm with LESS 👍 |
@jlukic and what about something like Bootstrap for colors?
They're reusing those for buttons, labels and progress bars. This is definitely more maintainable and evolutive to me. Imagine if you decide to use red and blue as main colors in your brand new website. And one day you want to replace red with yellow. You'll have 2 "bad" choices then : set red value as something like #FFFF00 or replace every 'red' classes in your HTML. |
The config list is going to probably be much more extensive. Semantic uses Here's the global variable lists so far.. and this is just starting |
@jlukic. Just in case, with LESS 1.5.0 you can write your #26021333 color loop this way:
(It is also possible to get p.s. Of course I don't mean one should go that way in the library, I just felt I need to mention that LESS loops (when you need those) are not so very different by now. |
For the sake of readability (both human and computer), please don't use a loop unless it's really really important. I'd rather write that handlebars stylesheet thing (stylebars?). It actually sounds like something id'd use so I might anyway... |
My 2 Cents: @jlukic It actually makes more sense to do SCSS instead of LESS, beyond what has already been discussed. Since SCSS doesn't have an official JS component, no one will try to render it in browser, which is really just a waste of resources when it comes to production sites. Also, this is something that should always be done prior to upload to a server, thus the "pre" in "pre-processing" @brigand as far as setting up a server, if you don't mind using PHP, give Pagoda Box a try. You should be able to easily handle 50k+ hits per day on their free plan. |
Actually no, I have never used Heroku. Not that Heroku isn't good, I just simply have had more efficient alternatives for my specific applications in the past. By my definition of a web worker, it should have access to the same scripts as the main application, though it should not require them for the most part. Also your description of scalable app is accurate, though in my description the workers have dedicated resources and complete jobs as resources become available (rather than on a schedule) For this application, we should easily be able to get away with a single database and avoid the whole master/slave thing. (mostly because the database would be almost exclusively for jobs) Finally, I would opt for a MySQL database simply because I more familiar with it, though I am open to the idea of Redis. The reasons why I suggested a web worker in the first place, is to keep from bogging down the web node, keep the app scalable, and possibly even have it hosted for free (given resource requirements are low enough). |
@nicholas Jordon Just clearing up some confusion
Dotcloud support the use of Django with Celery: On Tue, Nov 12, 2013 at 5:05 AM, Nicholas Jordon
*I must not fear. * |
@nicholas Jordon additionally, a celery worker isn't limited to a schedule based approach. On Tue, Nov 12, 2013 at 8:40 AM, airtonix airtonix@gmail.com wrote:
*I must not fear. * |
@gundead222 yeah, I know. I think the gist of the conversation so far is "We want plain CSS, plus variables and loops". |
I've started to implement a theming structure that should allow per-ui element theming that can be safely used without interfering with package management / version updating. Its using a similar set-up to sublime text where all user settings are kept in a separate file that overrides the package default, which lets you keep your settings between version updates. It will also have built in support for CSS overrides for themes. See the css branch for the current draft form. |
Cool, I'm interested in that for something as soon as you can share it On Tue, Nov 12, 2013 at 6:02 PM, Jack Lukic notifications@github.comwrote:
|
no ruby dependency anymore, pure C ! also nodejs integration +1 for SASS at some point in the future |
There will be native SASS and LESS support for themeing! I haven't had reliable enough connection yet to push to github, but will be sharing more related to this shortly. Still a lot of work to do, but inheritance will work with Package defaults --> theme defaults --> user overrides Each level is per element and consists of both (css overrides + variable overrides) Will be doing a couple basic themes to give a better sense of the capability (github style buttons for one) This is a similar structure to sublime text with user settings. Pretty excited! |
Found my way here from the website's [Contributing] page, and it looks like you've landed on LESS with only variables--which is cool. 😸 If you do start looking around again--and want to keep it simpler still--you might take a look at Myth. It uses the CSS3 for the language and pre-processes that "down" to something that works in current browsers. If you're sticking with just variables, Firefox 29 will have support for It seems pretty nice to know you're "coding for the future" and only dependent on a pre-processor for the time being. Just an idea 💡 |
+1 for SASS ;) Don't do it like Bootstrap! |
I'm developing with LESS, using imports and variables only. You can see a live example here Variables are per element, with global inheritance for things like |
Libsass solves your problems. You guys need to forget about reinventing the wheel & focus on the important issues. I use gulp-sass with Foundation 5 with no problems. |
@brigand Maybe I missed something, but couldn't you guys use https://travis-ci.org/ as your build server (it's free and excellent from what I hear) and have it compile SCSS to CSS on your behalf? |
@cowwoc the problem is more about integration with nodejs and browser tools for users. I don't have much experience with SCSS, but things like taking a JSON configuration file and using it to set variables when building the stylesheet are important to do. And like @jlukic said, you can easily convert it to a language that works for you. |
@brigand Maybe I missed something, but I thought that the SCSS files were just used internally (by the authors of Semantic-UI) to generate the final CSS files, and end-users were supposed to override values by declaring their own CSS files (as opposed to editing those belonging to Semantic-UI). |
@cowwoc currently, yes. For 1.0 there's going to be variables which can be changed to create themes; and users will often want to create their own themes to reflect branding, etc. This can be done with a web GUI, or in your build system (grunt, gulp, make, etc.). |
@cowwoc SCCS is just a syntax for Sass. And tell us what you can't make with sass ? even with grunt or whatever. |
@brigand I don't see why end-users need their own theme server. I'm expecting http://semantic-ui.com/ to offer something like http://jqueryui.com/themeroller/ which compiles SCSS, LESS or whatever in the background and sends the compiled CSS files to the user.Anyone wanting to run this themselves (and I don't see why they would) should expect it to be a non-trivial process. @ahmadseleem You're preaching to the converted. I'm arguing for SCSS, not against it. |
@cowwoc I guess the point is: all semantic-ui uses from the preprocessors is variables; so there's no gain in switching to any particular one. LESS works fine, and has the benefit of being compatible with a GitHub hosted customizer tool. Ports are simple if your workflow requires a certain preprocessor. I don't even like LESS; it's just good enough for this use case. |
@cowwoc I'm sorry my last message was meant to @brigand ! |
You guys have just about 57 contributors but 797 fork!! |
No one is die hard for any framework here. LESS is being used because something has to be used, and it is a good, lightweight choice with widespread community support. Novice users will be more comfortable setting up LESS compilation then SCSS, although SCSS has more features and in my opinion is the better framework for experienced developers. That being said, I think getting into a flamewars about the relative amazingness of different pre-compiled CSS languages is a bit ridiculous and tangential from the project's goals. We are only using a limited feature-set of the language, as previously discussed. Other language features like control structures, nesting, and mix-ins are not part of our requirements. As previously stated, it will also be relatively easy to write ports for SCSS, although the most up to date version will always be released in LESS first. |
Marking this off as completed. |
CSS Updates
Developing
LESS updates is a major feature for 1.0 and will be found in
css
branch.Global Variables
UI Variables
Other Pre-processing Features
NO NOs
The text was updated successfully, but these errors were encountered: