-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change the pre-processor for css #1167
Comments
Why is Less or Sass marked as "preferable"? I vote for PostCSS, to stay in line with future CSS specs. See also CSSNext which is basically a preset that configures a collection of PostCSS plugins out of the box. Although the Sass SCSS syntax is nice, I dislike the tooling very much because it relies on native builds for each platform (written in C++). Any time that someone runs I have used Sass a ton in various projects, and lately I have been so annoyed with build errors and things not working due to native modules getting in the way, that I've personally been happier using pure-JS alternatives like Stylus. Even if Sass syntax is nicer, the Stylus tooling is much more friendly. I haven't ran into any problems with Stylus tooling, but with Sass I swear every other week some build problems happen and it gets very annoying to have to stop developing to figure out what's wrong. And even In my humble opinion, choosing Sass will introduce a maintenance burden, and some end users may even open new issues when they encounter these problems although it isn't our fault. Let's no pick Sass! I haven't used |
Here's an interesting stat. Weekly download for each:
|
I am always ready to bet on postCSS. it gives us a huge control to our processing. let's have postcss then. We need to list down some plugins which we want to use . currently I am thinking of
any other ? |
I will take a dig in this soon. will create a pack with the plugins we want. |
I forgot CSSNext was deprecated in favor of postcss-preset-env, which is looking nice. Regarding plugins, do you want to avoid just choosing, for example, all (Neat that all these features are proposals for actual CSS, so eventually we may remove build steps for them, unlike Sass/Less/Stylus!) |
nesting is one of the things I am interested to write for future CSS. I wonder if we can pick the features and use them.? |
I think we can . ref this |
It may be easier to just pick "stage 1", but yeah we can also just pick individual features. It's only for dev mode anyways, so it may not matter if there's more dependencies or not for compiling the CSS. |
Also nice list of features by stage at http://preset-env.cssdb.org/features, and http://cssdb.org has the official list of proposals with stage level. |
cool, lets have stage 1 then |
I think discussions like this are most productive when we focus on problems that need to be solved. Perhaps I'm missing something, but so far I haven't read an "issue" in this issue. That being said, I do have some thoughts on the pre/post-processor debate that may be useful for future discussions. As the author of a complex grid system compatible with Less, Sass, Stylus and PostCSS, I've spent my fair share of time with each of these tools.
Whew. My vote would be for PostCSS + (Dart) Sass largely because this is what docsify-themeable currently uses. I could make the conversion to something else, but I don't see how that would be a good use of time without some compelling arguments. |
thanks for the detailed points. I agree that it can be a barrier for others to contribute and also we may not get most of the features we get from other processors like loops (we can get them through other plugins but not from postcss-preset-env ... maintainability cost should be considered here. ) about dart-sass, it does need some experience with maybe cc @trusktr thoughts? |
To clarify, The “sass” package on npm is Dart Sass. Dart Sass compiles to pure JavaScript, so it is a drop-in replacement for node-sass (with some api differences and a few quirks to be considered). I misspoke above though: docsify-themeable is currently using node-sass. Switching over to sass (Dart Sass) was as easy as installing the sass module and fixing one issue in my source that Dart Sass didn’t like but node-sass was okay with. |
so if we want to use it with postcss I believe we need to use the sass parser for postcss right ? |
We use two npm packages: 1) sass and 2) postcss (+ plugins). Sass will process |
ohh I thought of having sass in yea this seems better 👍 |
Awesome! I just realized this. All my issued were with node-sass.
@jhildenbiddle I converted an old card I found in the formerly "5.0!" board that I assume someone put there a long time ago. I didn't open the issue intending for this to be a task, but had simply converted the existing cards into issue.
Is it even worth switching from stylus to sass then? One less thing to do if we don't convert. EDIT: As docsify-themeable is already in sass, then yeah we'll need to make a choice.
What about postcss-env? That seems to give us all the features without the cobbling and without a custom config. What is really attractive about it is the future-forward compatibility with syntax that is being planned (who knows what will actually make it though). It's like using coffeescript instead of Babel nowadays I feel like (though I don't know how accurate that simile is).
Curious why you chose postcss + sass vs postcss-env (would like to learn your thoughts, I have less experience in this area). I'm curious to know what postcss-env (without config, just using defaults with everything) lacks compared sass/stylus. Regarding documentation, the https://preset-env.cssdb.org/features website seems to have enough documentation to allow me to use all the features. What sorts of docs are missing? Or you mean configuration docs (for each plugin) are missing from there, for example? If we use postcss-env, wouldn't we avoid having to worry about configuration mostly? The usage looks fairly straight forward and simple: https://github.com/csstools/postcss-preset-env#usage |
postcss-env is an interesting project. It can replace a preprocessor like Sass but only if the following are true:
The first item is self-explanatory. The second item is (to me) the more interesting one. Consider the CSS working stage definitions. Only stage 3+ features are considered "stable and subject to little change", and only six features offered by postcss-env match this description: By default (i.e. no configuration), postcss-env supports stage 2+ features which "should be considered relatively unstable and subject to change". Using stage 2, stage 1, or stage 0 features becomes increasingly more risky as their syntax and/or functionality is increasingly likely to change. When this happens, updates to CSS will be required. Hopefully each individual postcss plugin responsible for handling a feature will be able to recognize the use of an "older" syntax and provide some kind of warning, but what if they don't (or can't)? The end result is a breaking change that may or may not be detected and fixed before it gets released to the public. To make a quick comparison of postcss-env and Sass, consider the ability to nest rules (W3C spec, postcss-nesting plugin, Sass docs). Using postcss-env, this is a "highly unstable and subject to change" feature (stage 1) while Sass' implementation is stable with additional features. Postcss-env is limited and less stable because it is tied to a work-in-progress W3C proposal. Sass does not have this dependency, which is why it has been able to offer this feature with additional functionality for years.
postcss-env doesn't offer the same features as other processors like Sass, nor is it intended to. It is intended to make CSS features for which there are W3C specifications (in various stages of development) available to developers before they are widely adopted by browsers. Postcss offers an impressive collection of plugins that provide functionality for which no W3C specification exists, but these plugins would not be added to postcss-env because their functionality is outside of the scope of what postcss-env is designed to do. If you want "unofficial" functionality (perhaps to match what Sass does), then you're back to creating and managing a custom postcss configuration.
Some of the big differentiators are flow control ( CSS preprocessors are intended to make life easier, so I favored the tool that did that.
Only if, as per the first answer above, the maintainers 1) do not value the additional features offered by other preprocessors and 2) we accept the risks involved with writing CSS per work-in-progress specifications that are likely to change. Personally, I enjoy the extra features Sass provides and I prefer the stability Sass' syntax. As for postcss itself, I stand by my statement from an earlier comment:
Here is a list of the postcss plugins used by docsify-themeable, each of which performs a tasks that Sass is not designed to handle: In summary: Sass for authoring CSS, PostCSS to fix CSS. Hope this helps explain things a big better. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been addressed by PR #2469. The changes will be available when Docsify v5 is released. |
Currently, we are using
stylus
for writing CSS but we can consider moving withLESS
orSASS (preferable)
.The text was updated successfully, but these errors were encountered: