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

@import list formatting #37

Closed
MichaelArestad opened this issue Jan 6, 2015 · 6 comments
Closed

@import list formatting #37

MichaelArestad opened this issue Jan 6, 2015 · 6 comments
Labels

Comments

@MichaelArestad
Copy link
Contributor

This is likely something that comes down to preference, but I usually prefer import lists to look something like this:

@import "vendors/bootstrap",
  "vendors/jquery-ui";

@import "utils/variables",
  "utils/functions",
  "utils/mixins",
  "utils/placeholders";

@import "base/reset",
  "base/typography";

@import "layout/navigation",
  "layout/grid",
  "layout/header",
  "layout/footer",
  "layout/sidebar",
  "layout/forms";

@import "components/buttons",
  "components/carousel",
  "components/cover",
  "components/dropdown";

@import "pages/home",
  "pages/contact";

@import "themes/theme",
  "themes/admin";

And (I've not tested this), but maybe even:

@import
  "components/buttons",
  "components/carousel",
  "components/cover",
  "components/dropdown";

Pros

  • Easier to scan
  • Very obvious sections

Cons

  • Can be slightly more annoying to add/remove the last item because the semocolor needs to be relocated.
  • ??
@Keats
Copy link

Keats commented Jan 6, 2015

I don't find the first one very readable but the second one looks very good.
Overall I still prefer commenting/adding/removing/moving lines easily, so the one currently recommended still wins for me.

@MichaelArestad
Copy link
Contributor Author

Adding/removing/commenting is still just as simple with the exception of the last item. For some reason, repeating @import over and over just feels like visual clutter to me.

@KittyGiraudel
Copy link
Owner

Nope on the first. Perhaps on the second, although I am really not convinced at this point Michael.

@MichaelArestad
Copy link
Contributor Author

Neither am I, to be honest as the gains are pretty marginal. I do think it's worth a little discussion, though.

@sturobson
Copy link

I've started going with 'number 2' as it just saves a little bit of time writing it out. Tabbing (where my IDE creates spaces) is quicker than writing @import on every line.
In terms of gains: There's better readability as you can concentrate on the files you're pulling in as you're not laboured with @import everywhere and if you've a long manifest of imports it'd be a lot easier. in my most humblest of opinions.

@KittyGiraudel
Copy link
Owner

I like the second version as well. I might consider switching to it.

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

No branches or pull requests

4 participants