196 points · by 1000ch · 10y ago · 150 comments
If you want to put things beside each other, make them whatever widths you want and have a flex row.
What do 'grid systems' add apart from visual classes in HTML and negative margin hacks?
Hell, the only reason I use Bootstrap is for it's buttons and forms, etc. which nowadays I've replaced with PureCSS; and the best part about PureCSS is that I can use the bits I want and ignore the rest. Bootstrap can also do that, but requires a preprocessor like Sass or Less (v4 and v3 respectively).
http://getbootstrap.com/customize/
Just untick the boxes for the stuff you don't want, and hey, Bob's your uncle. No Less or Sass required.
a) The concept of a typographic grid is a print layout design tool fundamentally unsuitable for coding flexible component-based layouts on today's web (it probably always was, but talking about a "grid" can give designers an air of technical mystique they quite enjoy ;)
b) Flexbox was invented to move beyond the grid. We don't want or need a grid anymore.
c) It takes less than 1 day's effort to learn the vanilla CSS flexbox API and you can re-create this "grid" if you really need it with a few lines of plain CSS. No framework dependencies, other developers don't have to learn the framework, and no polluting your markup with global utility classes.
This SO answer says [1]:
> a name must begin with an underscore (_), a hyphen (-), or a letter(a–z), followed by any number of hyphens, underscores, letters, or numbers. There is a catch: if the first character is a hyphen, the second character must be a letter or underscore, and the name must be at least 2 characters long.
[1]: http://stackoverflow.com/a/449000
Which references the CSS Grammar spec [2].
I've been enjoying Lost (https://github.com/peterramsing/lost) with PostCSS for grids recently - it has Flexbox support which works well and keeps grid class names out of my markup.
Re: this post
Grd doesn't do anything interesting at all. Everyone is blindly obsessed with flexbox. Grd doesn't even concern itself with gutters.
Here's something I cooked up in 5 minutes that does more with less code: http://codepen.io/corysimmons/pen/eZgZzz?editors=1100
.Grid.\-stretch { align-items: stretch; }[1] = https://www.w3.org/TR/CSS21/syndata.html#vendor-keywords
It means that this `.-stretch` needs a class `.Grid` on the same element
The source leverages calc for simple width percentages, so on android browser below 47 these values won't calculate at all: http://caniuse.com/#feat=calc.
> Partial support in Android Browser 4.4 refers to the browser lacking the ability to multiply and divide values.
Why wouldn't the author change this to:
.Cell.\-1of12 { width: calc(100% * 3 / 12); }
to
.Cell.\-1of12 { width: 25% ; }
It seems silly to go through the trouble of installing a lib when it gives you less browser support than flexbox itself.
It's a pretty odd use for a preprocessor.
Each mixin is only used once (so why bother?) and the calcs are turned into percentages by the compiler (so why bother?)
I have a CSS code that looks like this for a good reason:
left: calc(100% + 2em)
that I'd like it to be changed to support legacy stock Android browsers.Size and therefore speed is important on the web, but it seems an easy mental trap to optimize it at the expense of the other important things.
The live demo doesn't work for me
The only problem here is that "who cares" if it is a "cute name". This isn't really DRY in a non-trivial sense. I mean, yet another grid system that calls grid-like things "grids". Yergh! Go read Brian Cantwell Smith's paper on "semiotic alchemy". More practically, I would say that all the points about filesize and what not are sadly irrelevant as true sources of anger. I honestly see this as no different as someone getting angry with someone else because they bought a foreign part to put in an American car. More puffery!
We have 7 "big" problems in CSS today:
Global Namespaces,
Dependencies,
Dead Code Elimination,
Minification,
Sharing Constants,
Non-deterministic Resolution,
Isolation.
What happened to the pursuit of truth? Alright. You put a framework on your résumé? But are you a computer scientist? Are you defending an idea? Or simply leveraging an old one?We take and depend on a lot of code today. But now we are taking and depending on higher order concepts or principles to give the illusion of pursuit... of something.
This is a "grid system" only in name insofar as it surely is detached from the idea of why grid systems were invented, mostly assuredly, to solve problems.
The "filesize" problem of CSS is like the "filesize" problem of Bitcoin. It's just that nobody really likes CSS or knows they can build Turing Machines in it, so they hate you for it. Whereas in Bitcoin, it gets you a seed round to test yr vaporware. At least these little CSS publications don't cost society that much, I guess..
Typically when I venture down this path of "system building" in CSS land, I use Organic CSS[0] because it promotes fun, thinking, creativity, and gives me a scientific scheme within which to treat those 7 problems listed above.
Does this grid framework solve any of those problems listed above? Is it even concerned with them? Are devshops aching to refactor to the next tiniest grid system? Are we really looking to shave off submilliseconds from our HTTP requests? I mean, we have HTTP/2... so do those submilliseconds really matter these days?
er mah GRD, it's amazing!
You DO NOT NEED to use bower or npm to install this, you can easily find the source and bring it in to your project if you want to use this. Npm does provide you with a way to upgrade this without digging around, but you don't have to use it, so stfu, go find your file on the Internet, copy it to your css directory.
A reason a flex grid could be cool, it provides you a standard across your application. When you one-off every time you need to have elements behave in a grid-like fashion, you run a much higher risk of ending up with inconsistencies. Unless you yourself write some code that reliably makes things behave like a grid, hey that's called a grid.
I get that there are a lot of tools available, but this recent attitude of just slamming people because they created something that isn't aligned with your ideals is not healthy or progressive. There is no implication that because this exists anyone else has to use it. It's just code someone wrote and happened to end up here. Let it be.
We are in 2016. If you are a front end developer and you do not have at least one terminal opened in the front end directory of your website ready to run NPM or Bower and you are still managing your dependancies manually, there is something very wrong with your workflow.
The vicious cycle of furious evolution in JavaScript is proving "too fast for comfort" for many of us. We do not all live entirely in the JavaScript ecosystem and no longer have the capacity to keep up with it. However remains the only language we can use in the browser so we are forced to use it and as it continues to accelerate, it becomes like an uncomfortably aggressive personal trainer screaming at us to "push harder" and trying to goad us into moving quicker.
We do not have the choice to use JavaScript or not, so when it feels like is it angers us. We feel the parts of the JavaScript development community that push this ever faster, have taken no one else into account and are no longer interested in being good citizens of the web in cooperation with all us other developers. We feel understandably uncomfortable with this sudden "aggressive independence" in the JavaScript community.
I'm quite sure a non trivial portion of the support for WebAssembly is because we want an alternative to JavaScript that enables us to escape from this situation. Many developers I talk to are eager to see their language of choice integrated via WASM so the are no longer forced to use JavaScript and much of the desire stems from being ever more unhappy with the direction of the JavaScript community.
Everyone is entitled to their opinion, so many of us are glad we will soon have a place where our opinion matters too, not only the opinions of JavaScript developers.
I get that the javascript world moves pretty fast. On the other hand, what you seem to be saying is, "I don't understand this, _and I do not want to expend the effort to understand it_, so therefore it is bad".
There's a lot of things I don't understand, and frankly don't have the time, energy, or training to understand. I leave those things to the engineers who actually worry about them. Example: I can write and optimize SQL queries, but I don't want to work on postgres internals. If you want to be a javascript developer, you should pay attention to the state of the art.
FWIW: npm isn't in control of modern javascript development. You are still able to manually find new libraries, download them, add them to your assets directory, include them, and so on. This workflow never stopped working. All npm does is provide a centralized list of library versions and their locations, along with a syntax for declaring dependencies. My current project needs to do some image manipulation, so npm handles downloading and building the mmagic libraries for my development architecture. I could do this on my own, but this is just easier.
If it's too hard for you, just do it the old-fashioned way. If you choose to publish a library and not provide npm/bower support because you're old-fashioned, however, don't expect wide adoption.
Those are simply two tools used by the JS community to manage its dependancies. There are a lot[1] of them.
Where I work, everything was pushed by the back-end guys for a long time. This made the front-end developer dependant on them. With tools that use front-end languages (JavaScript), the front-end team is now free to experiment with package management and build systems (Grunt.js, Gulp.js). This made it so that we now have a very complex but quick and useful front-end workflow. We wouldn't have this if we had not freed the front end team dependancy on the back end team for builds, dependancies, etc.
[1] https://www.npmjs.com/ http://bower.io/ http://duojs.org/ http://webpack.github.io/ https://github.com/componentjs/component http://enderjs.com/ http://jamjs.org/ http://volojs.org/ etc.
All of those are valid:
{ "dependencies" :
{
"foo" : "1.0.0 - 2.9999.9999",
"bar" : ">=1.0.2 <2.1.2",
"baz" : ">1.0.2 <=2.3.4",
"boo" : "2.0.1",
"qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0",
"til" : "~1.2",
"elf" : "~1.2.3",
"two" : "2.x",
"thr" : "3.3.x",
"lat" : "latest"
}
}Nowadays, and quite suddenly, javascript is at the center of everything. Java applets? Flash? Everything's imploded. On top of that, we're revolutionizing the language (block-lexical scoping, classical OO syntactical sugar, standardizing import/export, promises, generators, async/await, optional type annotations) in a way that improves productivity and the reach of the language.
There's a lot of churn in tooling and tools, because things are new. I've been doing software since before the STL and generics in c++, and I can say that I've seen this kind of churn before. It happens with lots of languages when they turn the corner in real exponential growth. I'd say it used to be the case that there were far fewer programmers in general, and they were a far more homogeneous lot than they are now (we still have a long way to go on that front, of course), so standardizing around autoconf and make was easier than standardizing around (say) ant vs maven or grunt vs gulp.
To the original issue - I've been doing a lot of flexbox work lately, and one of the more annoying issues is dealing specifically with grids. If you just use flex-grow like a good flexboxer, stuff doesn't align well in columnar format on your page. Flexbox is great for some things, but handy macros for making a grid out of flex boxes are pretty useful. Useful enough that I ended up writing pretty much the same thing myself anyway, and useful enough that it makes sense to hoist some of that code out into a standalone library. That way, you can encapsulate fixes for browser quirks (shakes fist safariiiiiii!), and have the option to pull the whole thing into new projects or leave it out if you don't need it.
People can complain about making a spiffy project page for a small library, but hey. People complain about a lot of things. Those kids, for example, on my lawn. I installed a motion-controlled sprinkler to keep them off, but those wacky kids are still on my lawn.
Grunt gulp bower less sass npm node yeoman brunch underscore moustache… Whenever our frontend devs insist they need whatever deployed on all our servers yesterday, I nod and smile and count the days until they've completely forgotten about it and yell for the next shiney new toy that's totally going revolutionize JS development. This time for real.
Meanwhile I'll stick to my makefiles, thank you very much.
You included underscore, which might as well be named "utils.js", alongside moustache, which is a templating tool, and Grunt/Gulp/Bower/npm, which are build or dependency management tools that have some real complexity.
These things are not like each other! It seems like you're just complaining about a bunch of things based on little more than what their name is.
I only know the name, because they disappear faster from our tool chain than I (as strictly ops/backend person) can keep up with familiarizing myself with them. The tool churn in the frontend world is insane.
There is a metastasis of so-called tools in the web-dev world nowadays. Setting up a moderate C project is way easier and less tools-involved than setting up a HTML-CSS thingy following the fashion of today. This one project in particular sports upwards of ten files to distribute what's worth a half page of CSS.
If there's a library that I use across all my projects, then I just subscribe to its syndication (mostly VCS RSS feeds for me). And then I fetch it if the changes are of my interest, or there are bugfixes. All these other tools are completely superfluous. How many hours are lost in your shop setting these pieces of crap up instead of just downloading the file and putting it in your assets directory? The whole web dev business of today is a big stupid mess of people who have no clue what they're doing.
The amount of hours lost setting up "these pieces of crap" is effectively zero, I type `npm install --save <insert lib>` and I'm on my way. If I need changes that are of interest to me, I type `npm update <insert lib>`. But guess what, that's not the only way to do things. I also download files and drop them in. I analyze each situation and make a decision. I am glad you think we don't know what we're doing, because it shows that you have no idea what we're doing either.
I like package managers because it saves me having to clutter up my git repositories with copies of my dependencies' JS files. You just have one package.json file for NPM, run npm install and you're done...
This is why I don't hang out with developers
I think we're blessed that the discussions in this forum are usually constructive & critical but respectful at the same time.
Where does this recent comment of mine fall? It is snarky but isn't it also substantive? I guess I could have left out the snark.
"I love it. We had servers, then we had clouds, and now we have personal clouds. Uh, isn't that a server?"
Syntax error at line 109 while loading: unexpected character: U+0060
grid.className = `Grid ${align.value}The framework itself looks handy and simple enough, but there's probably already about 10 other flexbox layout frameworks out there that works just as good too. Here's another one: http://gridlex.devlint.fr/
I actually think it was nice of the developer to say "Hey, you can install this with npm or bower". And if you don't like either, you can grab the source yourself. Or you can just not use it and move on.
I wouldn't use this myself just because I think using flexbox on its own is great. And there are plenty of problems in web development today. But calling it "insane" just feels like you were looking for something trivial to get upset about.
But I do agree that web dev tooling could use a lot of work. Grd did not set out to solve that.
https://raw.githubusercontent.com/1000ch/grd/gh-pages/dist/g...
I'm honestly not seeing what is there to complain about.
Imagine someone posting a repo of their alternatively-named C integer typedefs on here.
nt
An integer framework using stdint.h
Simple
It's just a header file
Light-weight
It's like 10 lines
Flexible
You can do anything
...
#include <stdint.h>
typedef int32_t nt32;
...It's a clear sign of people with no clue about proper software engineering, which is glaring in today's front end world where dependencies and tools have gone amok to manage mere hundreds lines of CSS or Javascript.
Just provide a download link to the min file and be done with it.
I just started to use npm (and indeed package managers in general) for my work recently and it's opened my eyes. It makes sense to me that this will be the preferred way of working for every dev/designer. Just as we mostly all use git now. It's hard to imagine that time when we just shared files via FTP and didnt use version control. I'd encourage anybody like me who was resistant, or working on a large code base that doesn't use those tools - give it a fair try on a side project.
And if you entire dependency chain for your project is half a Kb of CSS that's a valid point, I'd like to see that project though.
Dependency management for front-end/browser assets is sorely needed, the problem at the moment is that we have too many of them and no clear standards have emerged yet, npm/require() is as close as we've got though and I'll take it for now.
have you ever taken on a code base with thousands of lines of copy pasta code?
tried to update or workout dependencies/conflicts when the dude before you just dumped a bunch of jquery plugins (some hacked) in a directory?
give me a package.json any day! mmmm.. structured data.. nom nom nom
Not that hard right?
Don't like micro frameworks? Install bootstrap or foundation.
Why would anyone even want anything like it?
E: Nice to see again how childish HN is, downvoting when someone points out that the thing is broken and asks a serious question. This is why I originally left this place.