-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support for css #950
Support for css #950
Conversation
@kdy1 Are you working on this? I am helping out with https://github.com/connorskees/grass which is roughly the same speed as libsass (going to be deprecated I heard) and 2x faster than the defacto dart-sass without speed in mind, currently the project only aim to pass as much tests as possible. I wonder if we could use it here or are you planning on writing one? It passes 3375 of 5093 tests as of 2020-08-07. CC @connorskees |
@pickfire I didn't started seriously. Although I will determine after looking it's code, I think we can use it. |
I'm excited to see this is being discussed! With regard to #16, it is already planned that
There are a number of known, outstanding issues, but in practice it appears they do not come up very often. Please feel free to ping me for anything related to |
@connorskees Great to hear that! I will use it. |
Currently we have two interfaces, I personally think it is not that good. CC @connorskees pub fn from_path(p: &str, options: &Options) -> Result<String>;
pub fn from_string(p: String, options: &Options) -> Result<String>; But I think this is better. pub fn compile<R: io::Read, W: io::Write>(src: R, dst: W, options: &Options) -> Result<()>; @kdy1 What do you think would be better and easier to interface with swc? |
@pickfire Does it compile scss to css? |
Yes, the output is css. That is basically what the crate is doing, I don't see it being useful to compile sass to sass. Haha
Acceptable and even used by dart-sass. But not very flexible and performant, requires additional allocation for full |
@pickfire In fact Profiling has shown that this has very little impact on the actual performance, presumably because it is a one time cost compared to selector extension or style parsing which are performed hundreds to thousands of times for libraries like Bootstrap. I think the API you have described may be a form of premature optimization. |
@kdy1 So you are planning to write your own css parser instead of using something like cssparser from servo? |
I'm planning to write a new one. CSS does not have tricky syntax, so it will not be hard |
1414084
to
16faff9
Compare
@connorskees Does grass support getting original source line? |
@kdy1 Grass does that internally but not during the css output, IIRC there is no sourcemap support yet. |
@@ -10,7 +10,23 @@ pub struct Text { | |||
#[ast_node] | |||
pub struct Stylesheet { | |||
pub span: Span, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kdy1 Does swc usually keep span for all the struct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, many operations related to comment or a source map depend on the span.
How far away is this PR? Anything that can be done to help it along? |
@0rvar Most hard part is determining ast. |
Closing in favor of #2074 |
Closes #16