seanCodes / bootstrap-less-port

A Less port of Bootstrap v4
MIT License
102 stars 29 forks source link

A few tips #6

Closed matthew-dean closed 6 years ago

matthew-dean commented 6 years ago

Hi! I'm a contributor to Less. Great job on this port! I thought I would give you a few tips which might be helpful.

  1. Since Less v3.0, a user isn't required to write @import "../../node_modules/bootstrap-less-port/less/_functions";. The less-node FileManager resolves against NPM. So you should be able to write @import "bootstrap-less-port/less/_functions";

  2. For this: "Maps Less has no native concept of maps, which are used extensively in the Bootstrap Sass files..." Less v3.5 beta has just merged in support for re-purposing rulesets / mixins directly as map-like objects, by looking up their properties & values! It's much simpler than maps set / get syntax, and doesn't invent a new "map syntax" since rulesets, by their nature, are already map-like! Check out this PR and see what you think. https://github.com/less/less.js/pull/3242

  3. "Loops Sass @for and @each loops have been replaced with Less’s method of looping which requires unique, named mixins for every loop. This is a bit clunky and means that the loops used in this port are verbose and difficult to read, but it’s the best we’ve got until I can figure out how to overcome this with a plugin." I don't disagree, and there's been various syntax proposals over the years of how to make mixin calls/guards simpler and be consistent with Less's syntax / declarative nature. See this thread: https://github.com/less/less.js/issues/2270. Any suggestions welcome.

Hope that helps!

matthew-dean commented 6 years ago

Oh, also to this point:

Sass allows for custom functions to be written in the sass files themselves, which isn’t possible in Less.

That's technically true, but for simple "return values", you should find what you need in 3.5, by being able to call a mixin and retrieve a set variable / property.

Any other questions, you can also try the Less Gitter chatroom: https://gitter.im/less/less.js

seanCodes commented 6 years ago

@matthew-dean Thanks for all the feedback! I’m really looking forward to the new features in Less 3.5! I’ve been wanting to get this project onto Less v3 but one small-ish issue that’s been holding me back is that I use the app CodeKit to compile my Less, and it still comes bundled with v2. Since I imagine most users have dependencies on apps or packages that still use v2, I decided to hold off a bit, but I might just update and call it a breaking change.

For now, I’ll go ahead and create a branch for the update and try implementing some of the new features to test them out.

Thanks for all the work you’ve been doing maintaining Less by the way!

matthew-dean commented 6 years ago

Since I imagine most users have dependencies on apps or packages that still use v2,

Fair enough! It takes a while for people to iron out their dependencies. After all, I built https://getcrunch.co/ and even I haven't updated dependencies for Less lol. But then again, I've mostly stopped development for it.

Thanks for all the work you’ve been doing maintaining Less by the way!

You're welcome! I'm glad it helps.