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

Fix less plugin not able to receive less loader plugins #4645 #12898

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@slorber
Copy link
Contributor

slorber commented Mar 27, 2019

Currently we can't declare less loader plugins because plugins can be nested one inside each others, according to https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/bootstrap/load-plugins/load.js#L134

So forwarding the "lessPlugins" attribute to the plugins loader option is a workaround to avoid this problem.

See original issue #4645

But I think Gatsby should rather generalize find a more robust and generalized solution to this conflict between "gatsby plugins with gatsby subplugins" vs "gatsby plugin with plugin taking plugins as params"

Fix #4645
Currently we can't declare less loader plugins because plugins can be nested one inside each others, according to https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/bootstrap/load-plugins/load.js#L134

So forwarding the "lessPlugins" attribute to the plugins loader option is a workaround to avoid this problem.

See original issue #4645

But I think Gatsby should rather generalize find a more robust and generalized solution to this conflict between "gatsby plugins with gatsby subplugins" vs "gatsby plugin with plugin taking plugins as params"

@slorber slorber changed the title Fix #4645 Fix less plugin not able to receive less loader plugins #4645 Mar 27, 2019

slorber added some commits Mar 27, 2019

@@ -13,6 +13,7 @@ exports.onCreateWebpackConfig = (
options: {
sourceMap: !PRODUCTION,
...lessOptions,

This comment has been minimized.

Copy link
@slorber

slorber Mar 27, 2019

Author Contributor

Note it's important to put this AFTER ...lessOptions because the lessOptions always contain a plugin attribute which would override the lessPlugins attribute

This comment has been minimized.

Copy link
@pieh

pieh Apr 15, 2019

Contributor

This makes sense. Could you update plugin's README to show that to use less plugins, the lessPlugins option need to be used?

@@ -13,6 +13,7 @@ exports.onCreateWebpackConfig = (
options: {
sourceMap: !PRODUCTION,
...lessOptions,

This comment has been minimized.

Copy link
@pieh

pieh Apr 15, 2019

Contributor

This makes sense. Could you update plugin's README to show that to use less plugins, the lessPlugins option need to be used?

@pieh

This comment has been minimized.

Copy link
Contributor

pieh commented Apr 15, 2019

I'll fix unit tests after README changes - they only break because there is empty array by default, which is not present in snapshots

@slorber

This comment has been minimized.

Copy link
Contributor Author

slorber commented Apr 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.