Closed northwang-lucky closed 1 year ago
Hi there... just had another look at this PR. It's probably too specific of a use case for me to warrant including this in the core extension.
However, I would be open to the following:
To achieve this, you'll need to read up a bit on the following:
getExtension
APIExtension<T>
type (this is what's returned by getExtension
)... the basic pattern is that the activate(...)
method of the extension needs to return an object with one or more functions that will allow a secondary extension to build on the original extension. For example, we could modify the activate(...)
function in file easyLess.ts
to end like so:
// ...
context.subscriptions.push(compileLessSub);
context.subscriptions.push(willSaveEvent);
context.subscriptions.push(didSaveEvent);
context.subscriptions.push(didCloseEvent);
function registerPreprocessor(fn: PreprocessorFn): void {
// ... do the work here to register the preprocessor with EasyLess.
}
// Return an API for other extensions to build upon EasyLess.
return { registerPreprocessor };
}
type PreprocessorFn = (css: string): Promise<string>;
Please let me know if that makes sense and you can pick up the work or if you need me to implement the Preprocessor concept first.
@mrcrowl Thank you for your great idea. Here is another pull request about preprocessor. #97
Add a new feature that supports convert px to vw.