-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
User-defined value conversion function #2341
Comments
An example can be found at https://stackoverflow.com/questions/23834839/how-to-compute-the-cubehelix-color-scheme-in-less-js/26730511 |
Interesting, thanks for the link. Anyway to do so without creating a custom distribution of LESS? :) We are on LESS 1.7 and looking into creating a plugin - would this be the most flexible approach so that we don't get feature-locked by modifying core LESS files? |
Upgrade to 2.0 then use plugins http://lesscss.org/usage/#plugins-for-plugin-authors Sorry for the slow response. I've realised there is no function example, but it is along the same lines, you write a short js file and register new functions in the plugin init. |
Hi @lukeapage thanks for the response, that should work for us. Is there any documentation on adding rules via plugin? Edit: I'll open a new issue for this as it is somewhat unrelated, thanks. |
Hi @aarontam, Please see : http://stackoverflow.com/questions/27809514/how-to-exend-the-less-compiler-with-a-custom-function-leveraging The list of plugin is growing, see http://lesscss.org/usage/#plugins-list-of-less-plugins. You can use these plugins as an example. If you got any not working code already, you could post a question on stack overflow too. Or send me an e-mail. Notice that you also can use plugins to add custom function to Less easy. Examples can be found at https://github.com/less/less-plugin-advanced-color-functions/ (server side ) and https://github.com/bassjobsen/less-plugin-cubehelix (both server and client side) |
We wanted to create a function to smartly convert measurements in existing LESS files to resolution-independent units. Is there a recommended way of doing this so that we only pass the measurement value, and not the entire property set? We had tried some of the techniques mentioned in #637, but there were issues with complex calculations passed to our function i.e.
height: 2*@myVar + 10
and wanting to pass2*@myVar + 10
to our function. Additionally, we had looked into the technique mentioned in less/old-lesscss.org#54, but need support in node as well as the browser. Are there any recommendations on the best way to implement our conversion function? Thanks!The text was updated successfully, but these errors were encountered: