hexojs / hexo-renderer-stylus

Stylus renderer for Hexo
MIT License
18 stars 19 forks source link

Change the behavior of plugins configuration #59

Closed median-dxz closed 2 years ago

median-dxz commented 3 years ago

I have viewed https://github.com/hexojs/hexo/issues/4619#issuecomment-766592787 So I know the nib's repo use stylus v0.54.8 but it haven't been published. To remove the annoying warnings, I think users could disable nib in this renderer by using configuration like this if they don't need it :

stylus:
  plugins: ''

can it be applied to this renderer plugin?

tomap commented 3 years ago

With that change, you would be disabling nib by default. Not sure we want that. If we do, we would need to publish a new major version (breaking change)

median-dxz commented 3 years ago

With that change, you would be disabling nib by default. Not sure we want that. If we do, we would need to publish a new major version (breaking change)

I know we shouldn't change the default behavior, but it seems that the code isn't work well.. My thought is only when users set plugins: '' can they disable nib, otherwise nib will still be using in other situation.

@tomap Thank you for replying that.

median-dxz commented 3 years ago

Sorry for my mistake that the code in the previous PR not work with the behavior I expect.

It should be in the way like this:

- const plugins = ['nib'].concat(config.plugins || []);
+ const plugins = config.plugins ? ['nib'].concat(config.plugins) : (config.plugins === '' ? [] : ['nib']);

So, is that feature can be appiled? I am a Chinese, and my English may be not properly enough. Sorry for that.

stevenjoezhang commented 3 years ago

This problem is a bit tricky, because removing the nib plugin will break some old themes that depend on it. Maybe we need to start the migration work from the Hexo default theme landscape first, and tell the theme developers to avoid dependence on nib in the stylus file

See also https://github.com/stylus/nib/pull/348#issuecomment-851229459