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

Fixes #7927 #11097 - Convert inline JavaScript to @plugin #13242

Closed
wants to merge 2 commits into from

Conversation

matthew-dean
Copy link

This makes styles compatible with Less 3.x default settings (and also makes the code cleaner and eliminates global leaking).

You're welcome to take this and organize the plugin differently. I essentially concatted the inline JS in the other .less files.

Couple notes:

  1. Less already has a bunch of color manipulation functions, so I'm not sure why the tinycolor library is pasted in there.
  2. Previously, tinycolor and colorEasing were leaked as globals, but I wasn't sure if they were actually consumed anywhere. tinycolor is referenced in colorPalette, so that sort of made sense. But colorEasing?

I didn't have time to do linting or look at code conformity. This should get you 99% to using @plugin how you want though. Basically, in Less, you can register any functions you want, which accept nodes (not JS values - you'll notice in the code for the colorPalette function that the index is a node with a value property, not a number; likewise, the color is a parsed Less Color node). Then, all you have to do is return a Less node from that function.

Less tree nodes are here: https://github.com/less/less.js/tree/master/lib/less/tree

@netlify
Copy link

netlify bot commented Nov 22, 2018

Deploy preview for ant-design failed.

Built with commit 52d184d

https://app.netlify.com/sites/ant-design/deploys/5bf6553e0ff8d40d6b540b3e

@afc163 afc163 requested a review from yesmeck November 22, 2018 07:37
@netlify
Copy link

netlify bot commented Nov 22, 2018

Deploy preview for ant-design failed.

Built with commit ee612f5

https://app.netlify.com/sites/ant-design/deploys/5bf6561241174f24f5f536a0

@chenshuai2144
Copy link
Contributor

这件事总是需要做的,我们要不做了吧。这样和社区的生态也好对接

@zombieJ
Copy link
Member

zombieJ commented Dec 7, 2018

看起来要先升级一下 antd-tools,我看看 ant-design/antd-tools#79 能不能先搞掉。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants