segmentio / myth

A CSS preprocessor that acts like a polyfill for future versions of the spec.
4.32k stars 131 forks source link

add enabling/disabling feature support #87

Closed ianstormtaylor closed 10 years ago

ianstormtaylor commented 10 years ago

Okay, fixed that issue I was having sooner than I thought, so here is the refactor to make handling features pretty straightforward I think. @MoOx let me know what you think. Right now it doesn't smartly not re-parse based on whether it's looking for just the CSS or a plugin, but I think we could implement that by just using an extra option on options object, like reparse: false that's internal.

MoOx commented 10 years ago

lgtm except for the reparse thing. I think most of users are just simply using myth as is, not as a plugin, so reparsing by default don't make sense (it's 1/3 of the time of the processing - firstparsing/postcss parsing/reparsing). And if we just don't reparse, rework.obj will be outdated. I think prefixes should be a specific feature at the end of the process, to allow skiping last parsing by default. Otherwise this sounds nice. Exposing features will allow us to add custom features as well. I was also thinking give users the ability to add stuff like rework-rem-fallback (for thoses who still support IE8 :p) by just adding "rem-fallback" as a feature (with the appropriate npm install).

ianstormtaylor commented 10 years ago

@MoOx added a few more commits to fix the importer deprecation, and i think port the sourcemaps fix you had in the other pr. whenever you get a chance can you take a look at let me know what you think?

not sure how to elegantly solve the re-parsing, we might have to add a hack in index.js unfortunately, i was hoping to keep all the plugin-specific hacks to the features.js file :$

MoOx commented 10 years ago

@ianstormtaylor I've rebased your PR on master & add a test for sourcemap. So I'm merging. I'll try to see how we can keep plugin-specific stuff in features.js.