Skip to content
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

[Feature]: More Stylus options #3430

Closed
binarykitchen opened this issue Sep 10, 2024 · 0 comments · Fixed by #3434
Closed

[Feature]: More Stylus options #3430

binarykitchen opened this issue Sep 10, 2024 · 0 comments · Fixed by #3434

Comments

@binarykitchen
Copy link

What problem does this feature solve?

Trying to migrate from webpack to rsbuild here but stuck:

Webpack's stylus loader has the define option:
https://webpack.js.org/loaders/stylus-loader/#stylusoptions

type stylusOptions =
  | {
      use: Array<string | Function>;
      include: Array<string>;
      import: Array<string>;
      define: Array; // <------------------------------ this one is missing
      includeCSS: false;
      resolveURL: boolean | Object;
      lineNumbers: boolean;
      hoistAtrules: boolean;
      compress: boolean;
    }
  | (loaderContext: LoaderContext) => Array<string>;

In my app, this enables to pass over some variables from the code to the styles which is extremely useful, such as media sizes.

If this could be added, that would be great. Thanks.

What does the proposed API look like?

Presently, rsbuild has these types under @rsbuild/plugin-stylus/dist-types/index.d.ts:

type StylusOptions = {
    use?: string[];
    include?: string[];
    import?: string;
    resolveURL?: boolean;
    lineNumbers?: boolean;
    hoistAtrules?: boolean;
};

How about adding a new option named and typed the same way, define, allowing arrays? And in my code it would look like that:

define: [
  ["video-width", getVideoWidth(), true],
  ["video-height", getVideoHeight(), true],
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants