5 ms·
I'm not a web guy, but isn't sass a CSS generator, as in something you run once before deploying anything? What's the advantage of speed for something like this
by leif 13y ago
I'm not a web guy, but isn't sass a CSS generator, as in something you run once before deploying anything? What's the advantage of speed for something like this?
- jhgg 13y agoSaves a bit of time when you're in the edit your scss/sass files -> refresh browser workflow. A designer friend of mine always complains about how slow the ruby sass compiler is for larger projects, but he says the time saved in writing stylesheets with it beats the time spent having to wait for them to compile.
- chrisbolt 13y agoSpeed of deployment, especially for larger sites with more CSS to process.
- dpritchett 13y agoFaster deploys means more deploys means more features and fixes and a better chance of survival. See: John Boyd.
- TylerE 13y agoDepends. Many newer frameworks (Rails, at least, specifically) do not pregenerate but instead compile on the fly and then cache, at least in development mode. Also, the canonical SASS implementation is in Ruby, which is a fairly heavyweight dep if you need it JUST for to compile SASS
- akhleung 13y agoOn huge projects, Ruby Sass can be quite slow, taking several seconds or even minutes to compile. If you have an interactive, iterative workflow where you're constantly refreshing the styles, having a faster Sass compiler can be a godsend.
- clarle 13y agoIf you're in a language that allows C bindings, then it makes it easier to port a SASS library to that other language.
- habitue 13y agoNotably: https://pypi.python.org/pypi/sass https://pypi.python.org/pypi/sass
- hcatlin 13y agoSo, when big companies like Linkedin generate their Sass projects, it can take hours on a single machine. Tons of programmers all working in Sass. At Moovweb, some of our customer's projects can take 30 seconds just for the Sass to compile for fairly straightforward sites.
- leif 13y agoOk, that's more drastic than I thought. I think I get the point now.
- gkoberger 13y agoSeriously? I believe you, but if it's taking hours then it seems like the problem isn't as much with SASS but rather the way they write CSS or their build process. If they only recompiled changed files, there's no way it could take "hours". Even if they recompile everything... all CSS needs to be interpreted by the browser at some point. How much CSS do they have? That being said, what are the speed comparisons like?
- icambron 13y agoYeah, I'd love to hear more from Hampton on the hours thing. What actually takes so long? Why does the number of developers matter? I've worked on some substantial (though not LinkedIn-sized) projects that used SASS and I've never clear seconds in compilation time. Though I completely get the portability aspect.
- hcatlin 13y agoThey use https://github.com/linkedin/archetype https://github.com/linkedin/archetype which is an extension on top of Compass. Including all those libraries can mean a TON of memory and processing is required. Mixins calling mixins calling mixins. Plus, custom ruby extensions, etc. The needs of organizing hundreds of developers logically and making sure the code is optimized can be a hauss.
- 13y ago
- colechristensen 13y agoWith a C binding, this library is usable in more or less every language under the sun without messiness. Written in the correct way, a library like this will compile and run on a 15 year old OS, and will probably run on plenty of OSes in 15 years. The dependency hell of building old language binaries with a dozen badly supported other libraries doesn't exist when you link to libc/libstdc++/etc. There ought to be a speed advantage, but it definitely isn't the only motivation.
- ufo 13y agoWhat do you mean by "written in the correct way"?
- colechristensen 13y agoWritten in a way to make the second half of that statement true :) This involves things like keeping linked libraries to a minimum (and only to use ones which are commonly part of a default unix install), actually testing on a few different platforms, using standard build tools (despite their wonkiness), avoiding (compiler|architecture|OS)-specific features, and all sort of other guidelines that one should follow when trying to write portable software.
- twhid 13y agoReal world example: our project was taking almost 1 minute to compile via Ruby (all CSS). Using sassc (libsass) that went to 5 seconds. Development was where we saw real gains, different sections that would take 4-6 seconds to compile, went down to <500ms (our asset watcher is smart enough to compile only blocks of Sass files that are associated, not the entire site's Sass). Meaning that in the time it takes you to switch to your browser and refresh, the Sass would be compiled to CSS. Made my devs life much, much better!
- lightblade 13y agoWhoa! 5 seconds is still a long time. If you don't mind me asking, how many lines of SASS does the project have?
- twhid 13y ago>22,000 according to wc -l /*.scss (thanks stackoverflow!). Edit: > 24,000 (counting all files this time ;-) But I noticed that files missing a newline at the end weren't being counted correctly (missing 1 line in the count).
- WalterSear 13y agoEvery tiny change requires a recompile. On a really complicated site, that could be 30 seconds or more. And CSS is a >visual< language, that looks subtly different in all browsers and eventually requires a lot of 'stabbing in the dark' to find the perfect compromise.
- nadinengland 13y agoIf you were making small changes to see what worked in different browsers, rather than editing the CSS or SASS, it may be more beneficial to use the browser's Web Tool to do it live!
- WalterSear 13y agoYes, but only when you are making small changes to a single, and relatively static, page. And, you need to make the same changes in every browser at once. And, then you need to verify that the css changes you made correspond to the sass changes you make in the main document.