5 ms·
> Myth lets you write pure CSS while still giving you the benefits of tools like LESS and Sass. Having a "polyfill" is certainly a valid justification. But thi
by crazygringo 13y ago
> Myth lets you write pure CSS while still giving you the benefits of tools like LESS and Sass.
Having a "polyfill" is certainly a valid justification. But this doesn't come close to LESS/Sass -- I'd argue that the main feature of those is nested rules, and then mixins.
Variables and calculations are great, but most LESS code I've encountered uses nesting and mixins to a far greater extent. Advertising the project as "the benefits of tools like LESS and Sass" seems misleading, and seems to set up expectations that Myth doesn't fulfill.
- darth_aardvark 13y agoIt's not supposed to replace LESS/SASS, it's a supplement. That's why it's a postprocessor, not a preprocessor.
- masklinn 13y agoConsidering what it does duplicates a small part of what less and sass do, why would you use it?
- anthonyshort 13y agoI used to be a big supporter of Sass, but now I prefer the simplicity of CSS. Look at almost any Sass project and it's usually overly complicated. I stopped writing Sass a few months ago and I haven't felt crippled at all. The complexity of Sass/Less is starting to out-weigh the benefit of their features, for me at least.
- GeneralMayhem 13y agoThat's on the individual project maintainer, though. Any valid CSS3 file is also a valid SCSS file, so you can add enhancements on top of that exactly as much as you want to.
- ajanuary 13y agovar works differently in CSS than preprocessors, and in such a way that you can't combine them with preprocessed calc etc. statements. Having said that, I don't know if this polyfills the var spec exactly.
- jrochkind1 13y agoI don't get it. If you are using less or sass anyway.... why would you use myth as a post-processor, since myth doesn't do anything you couldn't do already in sass or less?
- L8D 13y agoWhen it says "giving you the benefits of tools like LESS and Sass" I think they are referring to how you can postprocess the CSS generate by LESS and Sass
- crazygringo 13y agoHmm... I can't quite see how the sentence could be parsed that way. But even if that is the case, it doesn't make any sense to me, and I can't begin to understand how they could be compatible with each other. How are you going to write "var(...)" or "color(...)" declarations within LESS, that LESS will ignore, just to "pass through" to Myth? And why would you? As far as I can tell, Myth doesn't do anything that LESS doesn't already do, so I don't see why anyone would add Myth on top of LESS.
- adamkochanowicz 13y agoMakes sense to me, actually.
- ianstormtaylor 13y agoYeah that's definitely true that it doesn't support all of the features of Sass or LESS. But it does support some of the core features that people use everyday, and could replace a lot of the need for preprocessing. From everything I've seen nesting rules is an anti-pattern. It's useful for writing code as fast as possible, but for any project of reasonable size maintenance is a far bigger worry than LOC per second, and nesting makes for some horrible to maintain CSS. Until we have native extending in CSS you're much better off going the "one-class-per-element" route for maintenance. As for mixins, I actually think they are an anti-pattern too. They're usually used for two different things. The first is to simply make vendor-prefixing easier, which this library already eliminates. For example the LESS homepage shows mixins being used when really it's just a regular old `border-radius` property. And the second is for extending classes with groups of properties, but mixins are a bad practice there because they just duplicate the code instead of doing any smart inheritance, so you end up with huge code bloat. The real missing feature from preprocessors in my opinion is the idea of "extending", but I wanted to wait for the CSS spec for extensions to be more thought out before adding it, in case it varies a lot from how preprocessors do it. --- The reason this came about is because we went back to writing pure CSS at Segment.io (after having used LESS, Stylus and Sass at different points) and realized that we shouldn't need to give up things like variables just because we don't want the extra weight of a new syntax.
- loupeabody 13y agoIs there a grunt module for Myth? Thanks very much for this, I'm looking forward to using it.
- ianstormtaylor 13y agoNope, just released the CLI/Node API today and haven't used Grunt personally. But would welcome someone making one! :)
- crazygringo 13y agoIf you think nesting rules is an anti-pattern, I feel like you've never worked on a large-scale web project. When you need to ensure that sections of pages are self-contained, and components likewise, you need to start every rule with ".titlebar" or ".large-button", etc. Nesting just makes your CSS much cleaner, by writing ".titlebar" once instead of 30 times (for each of the 30 rules that apply to things inside the title bar), and making your stylesheet more organized and easier to browse. It doesn't mean you need to nest every single element, but it's a fantastic tool for organization, particularly when multiple people are working on a project. Likewise, I feel like you're missing one of the main points of mixins -- that they allow you to repeat commonly used calculations that may involve multiple properties in complex ways. For example, a mixin I often use lets me create a vertical gradient by specifying a base color and a brightess spread amount, instead of start/end colors. It's incredibly valuable, and it also allows me to automatically support IE and specify a fallback base color. Mixins are hugely valuable for creating classes based on sprite positioning too. Going back to pure CSS without mixins would be a huge step backwards in maintainability for any project of decent size which I've worked on. Obviously, both nesting and mixins can be abused or used inappropriately, but I'd never call them anti-patterns -- to the contrary, they're essential for front-end development on sites that reach a certain level of complexity, for cleanly factored code.
- andreypopp 13y agoYou can have mixins with rework-macro[1] so it would be very easy to integrate it with myth if needed (myth is based on rework). [1]: https://github.com/andreypopp/rework-macro https://github.com/andreypopp/rework-macro
- worldsayshi 13y agoI first read it as - allowing you to use tools such as less/sass in 'conjunction'. I see now that was not really stated like that. But that seems the case anyway. It's compatible with a pipeline using both legacy css and less/sass.
- simonrobb 13y agoI like the idea of retaining preprocessors for nesting and mixins to write good CSS quickly, but also having the postprocessor at the other end to add polyfills where necessary. This way, I can write SASS to target modern browsers and not worry about backward compatibility so much, because I know the postprocessor is there to catch the older browsers. e.g.: I don't want to worry about specifying a solid block colour for CSS gradients, I just want to specify a gradient. But yes, I agree the implication that this could replace preprocessors is unrealistic.
- oe 13y agoThe most important feature of Sass is saving your fingers by not having to write those curly braces and semicolons. Everything else is a nice bonus.