Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> you're expected to run the compiler once to generate a single static, minified CSS file.

Yes, i stand corrected on that, i don't use them but that is not an excuse for ignorance. Plus compiling once makes more sense than compiling every time.

I also use webkit's web inspector for making live changes to a stylesheet and then saving the file in the end, very convenient compared to the changing-saving-uploading-refreshing cycle. Also it is another barrier to entry for my open source project. (someone has to know all the compiling process to contribute)

And as for uses of compilers, with CSS variables at the horizon (already functional in chrome canary IIRC) and other than this vendor prefixing problem (which everyone knows is very real and seeing the rapid release cycles of all major browsers now days, it is not far fetched to see a solution being cooked up some time soon) compilers don't have much to tackle. The cost v/s return ratio will reduce and probably even be negative in near future (if not already).

The cost is of compiling every time during development and once every time production code changes. I don't know about you, but if i am not live editing css in web inspector, i make a ton of very small changes to CSS and try them out one by one by refreshing the page. Not a great experience if i have to go to command line every time i change a byte.

> Efficiently combining multiple source files.

This problem can only arise in very big projects and if your project is in that category then there are all sorts of solutions available. (including writing your own compiler) But if that problem exists in a small or even middle sized project, them i believe, the solution is not the compiler but to re-factor the code base to use less files or merging them.



The most elegant way to handle this (IMO) is to use a combination of Compass(http://compass-style.org/) and Vogue(http://aboutcode.net/vogue/).

Compass has a great command line feature called "watch" that simply watches for file system events (linux, os x) or polls (windows) your folders for changes and recompiles your stylesheets.

Vogue detects stylesheet changes right away and reloads them in your page via WebSockets.

Instead of dealing with Chrome's inspector, making changes, then copying them to your CSS (and translating if you like SASS), I simply make changes in my editor on one monitor while watching my site on the other monitor. The overhead is minimal - I see changes within about 500ms.

Compass is great even just as a build tool, and I used it before I learned SASS. It's fantastic for its simple mixins like linear-gradient and even better when you start chaining them together. One of my favorite mixins I use throughout my code:

  @mixin buttonGradient($color){
    @include basicBackgroundGradient($color);
    &:hover, &.hover{
        @include basicBackgroundGradient(hover-color($color));
    }
    &:active, &.active{
        @include basicBackgroundGradient(active-color($color));
    }
  }

  @mixin basicBackgroundGradient($color, $percent:12%){
    background: $color;
    @include background-image(linear-gradient($color, darken($color, $percent)));
  }
Then, anywhere I want a green button to be created, I use the style @include buttonGradient(green);. Or any color. Keeping a stylesheet full of site-wide colors is incredibly useful and being able to modify them via functions like darker() and lighter() really saves time. Consider that this simple include actually generates 18 lines of CSS each time I invoke it - in the words of an old boss, now you're really cookin with gas.


Actually chrome has this feature too. When you have saved a file once manually, it keeps track. So whenever you make live changes on the resources panel it live updates the DOM and upon clicking save, it automatically rewrites the file at it's original location. So it pretty much mimics the solution you suggested without any command line tools, extra file inclusion, downloads, etc. (http://www.youtube.com/watch?v=3pxf3Ju2row)

If you go up, you can read my comment in which i say why i dont like extra libraries, compilers for web work. (http://news.ycombinator.com/item?id=4219980) This is pretty much why.

And for the global mixin, (Which is pretty cool IMO, it really enables a lot more possibilities and creativity) you pretty much give the reason not to use them anywhere out side of practice work. 18 lines are huge. Plus css variables are pretty much on horizon, it is well worth the wait.


> Not a great experience if i have to go to command line every time i change a byte.

That's why, as was already mentioned, you generate them on the fly during development and generate them statically for production. That way you change the file on the file in your editor and it's updated immediately in your dev environment, but there's zero overhead in production.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: