Git Product home page Git Product logo

family.scss's Introduction

Family.scss

npm version Bower version Build Status

Gitter

Version v1.0.8

Family.scss is a set of 26 smart Sass mixins which will help you to manage the style of :nth-child'ified elements, in an easy and classy way.

Website : https://lukyvj.github.io/family.scss/

Installation

Regular

Alternative install

  • $ npm install family.scss
  • $ bower install family.scss
  • gem install family-rails (maintained by pzi)

Family.scss on npm

Usage

First of all, you need to import Family.scss into your project. If you're using eyeglass you can import it as such:

@import "family";

Otherwise import the Family.scss source file.

Then you can use the mixins right away on your stylesheets.

Input :

ul li {
  background: blue;

  @include first(3) {
    background: blue;
  }
}

Output :

ul li {
  background: blue;
}
ul li:nth-child(-n + 3) {
  background: blue;
}

Why only Sass ?

It's true, I did it for Sass, but some awesome contributors extended it to :

Stargazers over time

Stargazers over time

Changelogs

v1.0.8

  • Repository consistency | No changes on the lib.

v1.0.7

  • Repository consistency - No big changes on the lib.
  • The source family.scss file is now on source/src/_family.scss instead of source/src/family.scss

v1.0.6

  • each-after() mixin removed, re-opening #37

v1.0.5

  • first-child() mixin added.
  • last-child() mixin added.
  • each-after() mixin added, closing #37
  • Mention Holmes.js in the about modal.

v1.0.3

  • first() mixin now uses :first-child if the given parameter is 1, closing #10
  • n-between() mixin added, closing #35
  • at-least(), at-most() and in-between() quantity queries mixins added, closing #24
  • pair-between() is now even -between(), closing #34
  • impair-between() is now odd-between(), closing #34
  • Source code for the header pattern generator added in the about modal
  • Version number added in the footer
  • backdrop-filter removed from the about page

family.scss's People

Contributors

emileriksen avatar haroenv avatar kittygiraudel avatar lukyvj avatar marcobiedermann avatar nicolas-t avatar pzi avatar redox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

family.scss's Issues

Special Chars occurs an error while compiling with sass

please change from

/// Will only select the child if it’s unique.

to

/// Will only select the child if it is unique.

if i do a npm install and include the _family.scss in my scss file and compile it with gulp/sass, it gives me an error because of bad sign. (US-ASCII) or maybe save it as UTF-8 or something.

thank you.

great project btw.

Bower dependency

Is it possible to have the library via bower?

Thank you.
PS: Awesome work 👍

Bower ignore

It looks like you're including a lot of extra stuff in the bower install that users probably won't need, you can use the ignore in your bower.json file to skip files from being downloaded.

For example, all I do is point to bower_components/family.scss/source/src and then I'm able to @import family and it will work. But I don't need any of the other files it pulled down (except maybe the bower.json itself and the readme and license if they're required by Bower).

And if you ever move the family.scss file to a different folder, make sure to do a major version change as some people will be pointing directly to it and that will be a breaking change for them.

Porting this to Stylus

Hey, I just ported family.scss to stylus, should I send a pull requ. or open a new repo

Every N after X

This possibly relates to issue #37, but it may also want to be a separate function. It'd be great to have a function to select every Nth item after the Xth child.

For example:

li {
    @include n-after(3,6)
    ....
}

would return

li:nth-child(3n+9) {
  ....
}

Note that it's +9, instead of +6 because +6 would highlight every 3rd including the 6th, instead of starting after. I've used this before for targeting the second row and on.

In addition, n-before in the same format would also be helpful, utilizing :nth-last-child instead of nth-child

Use `last-child` in `@mixin last()` when $num = 1

Good job the library. It is of great use.
While going through the code I observed you didn't use pseudo last-child in mixin last()
Just like mixin first() we can use last-child when $num = 1.
Would love to know why it was avoided.

License?

Hey Lucas,

Just wondering under what kind of License Family.scss is?
The reason why I am asking this is, I was thinking of creating a Ruby gem to wrap your mixin set and open source it.

Thanks for a great resource.

Cheers
Patrik

Publish to bower.io

It's preferable to have Sass mixins as a bower dependency so that you can include them from their bower folder, and keep the library up to date easily.

Make sure that you only have one main file in a folder called family.scss that others can point to and import. Having other Sass files in the same folder can cause conflicts if people are looking for stuff that has a matching name. This is why it's important to namespace your default file to family.scss and not something generic like style.sass. You can still import other sass files from subdirectories into your main file with no fear of conflicts.

Other libraries that do this:

If you set up bower like those libraries, I'll add family.scss to Scout-App so it will come with the processor out of the box.

Write tests

You are dealing with quite complex selectors. It would be nice to see a proper test suite.

Add a button group to switch bewteen .scss and .sass

There should be a switch/button group/radio group at the top to switch between scss and sass. Switching to .sass would change all the documentation from @import thing() to +thing(). To make it easier for copy/pasting from the documentation.

Could this be added to NPM

Hello,

May I ask this is added to NPM please, this would allow those of us who use it for all package management to use it easily

Thanks

Jonathan

Change mixins name

pair-between(n) => even-between(n)
impair-between(n) => odd-between(n)

Namespace mixins

Hi,

Really useful! Would it be a good idea to namespace each mixin, perhaps with 'fam-' or something? I know the @include last() mixins would at least conflict with the susy mixins. Or is there some sort of automatic way to namespace things in sass that i'm not aware of?

extend Each mixin

@mixin each($num, $k=0) {
  &:nth-child(#{$num}n + #{$k}) {
    @content;
  }
}

for grid like this
|#|&|&|
|#|&|&|
we need clear:left on first col

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.