mrcrowl / vscode-easy-less

Easy LESS extension for Visual Studio Code
MIT License
67 stars 23 forks source link

feat: add px to vw #96

Closed northwang-lucky closed 1 year ago

northwang-lucky commented 1 year ago

Add a new feature that supports convert px to vw.

mrcrowl commented 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:

... 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.

northwang-lucky commented 1 year ago

@mrcrowl Thank you for your great idea. Here is another pull request about preprocessor. #97