Coder Social home page Coder Social logo

7ninjas / scss-mixins Goto Github PK

View Code? Open in Web Editor NEW
145.0 8.0 35.0 272 KB

Collection of scss mixins and functions to ease and improve implementations of common style-code patterns.

Home Page: https://7ninjas.com/

License: MIT License

CSS 100.00%
mixins scss scss-mixins bootstrap frontend css sass css-modules styling

scss-mixins's Introduction

7ninjas

`scss-mixins` is a collection of scss mixins and functions to ease and improve implementations of common style-code patterns.

Discover our scss practices »

PortfolioCareersContact

Be like a Ninja! Style like a Ninja!

Status

npm npm npm

CircleCI branch David GitHub code size in bytes

GitHub pull requests GitHub issues GitHub closed issues

GitHub stars GitHub watchers

Quick start

Several quick start options are available:

  • Clone the repo: git clone https://github.com/7ninjas/scss-mixins.git
  • Install with npm: npm install @7ninjas/scss-mixins
  • Install with yarn: yarn add @7ninjas/scss-mixins

Usage

Import all file to your core scss file for importing all mixins from package

Example:

@import '~@7ninjas/scss-mixins/all';

Table of contents

Animations
Border Radius
Breakpoints
Buttons
Flex
Fonts
Forms
Gradients
Grid
Hover
Icons
Images
Lists
Positioning
Responsive
Shapes
Spacing
Tables
Typography
Variables

Bugs and feature requests

Found bug? Or maybe you've got great idea for feature request? Please first search for existing and closed issues. If your problem or idea is not addressed yet - don't hesitate to open a new issue!

Community

Get updates on 7ninjas's development and chat with the project maintainers and community members.

Versioning

To see new features and changes for each released version checkout the Releases section of our GitHub project

License

Code released under the MIT License.

scss-mixins's People

Contributors

arekrado avatar darthwade avatar jserhii avatar nerdy-girl 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

scss-mixins's Issues

list of small improvments

  • remove - /docs/base.md
  • fix title - /docs/forms.md#_flexscss
  • add description to responive col and prop about down-xs, between -/docs/responsive.md
  • add example with hex - /docs/colors.md
  • add usage example - /docs/forms.md#mixin-input-focus
  • fix example, more examples, error if size > columns - /docs/grid.md
  • more info about responsive and examples - /docs/typography.md
  • set $cross as x and $main as y, add if which can check flex-direction - /docs/flex.md
  • remove helpers
  • remove unnecessary ()

breakpoints throw error

after import mixins @import '~@7ninjas/scss-mixins/all'; compilator throws this error

Module build failed: 
    if($mixin != 'down' || $mixin != 'only' || $mixin != 'up') {
   ^
      Property "if" must be followed by a ':'
      in /my-project/node_modules/@7ninjas/scss-mixins/src/_breakpoints.scss (line 32, column 5)

Best Practices - SCSS Styleguide

Please add best practices document for project

  • reboot.css or normalize.css
  • help yourself with stylelint
  • naming conventions
    • don't reuse parent's class name in child's classes
    • keep order of declaring classes and it states (firstly declare state of current class then declare nested children ie. .active is higher than nested child class)
    • class should be described by entity, behaviour, state or look
    • camelCase in react, rest in hypen-case
    • color naming
  • spaces and indentations (2) (no tabs)
  • use mixins for margins and paddings
  • assign value to variable in variables.scss
  • first use mixins, then override styles (if needed)
  • never wander too deep -> don't go more than 3 levels deep (add stylelint rule)
  • don't style elements, style classes
  • don't use id if not needed
  • global styles
  • styles from another packages
  • creating JavaScript-specific classes to bind to, prefixed with .js-
  • overusing unclassed divs

update main color

white color isn't visible on white background

$body-color: $color-white;
$body-bg: $color-white;

fix:

$body-color: $color-black;
$body-bg: $color-white;

configure stylelint

my suggestion:

{
  "extends": [
    "stylelint-config-standard"
  ],
  "rules": {
  }
}

No mixin named border-radius

I tried to use border-radius, in all.scss border-radius is not imported

Failed to compile.

./src/routes/Home/components/home.scss
Module build failed:
  @include border-radius(10px);
          ^
      No mixin named border-radius
      in /Users/arek/better-config-xd/src/routes/Home/components/home.scss (line 5, column 12)

add templates

Please add contributing, issue and pull request template

Proposal - cover background image

How about adding mixin which can indicate how background image will work?
Many times we write

.example-class {
  background-image: url('...');
  background-size: cover;
  background-position: center;
}

Example:

.example-class {
  @include background-image($source: '...', $size: cover, $position: center);
}
  • as a source we would just past path to file, and inside mixin it would put variable into url tag?

It would faster our work. What do you think about it?

grid overriding gutters

  @include container;
  @include media-breakpoint-down(sm) {
    @include container($gutter: false);
  }

it's not possible to override first container by container without gutters. I have to use breakpoints:

  @include media-breakpoint-up(sm) {
    @include container;
  }
  @include media-breakpoint-down(sm) {
    @include container($gutter: false);
  }

how to fix it:

we need to update gutter mixin by adding else if

@mixin gutter($gutter: $grid-gutter-widths) {
  @if $gutter {
    @each $breakpoint-query, $gutter-width in $gutter {
      @include media-breakpoint-variant($breakpoint-query) {
        padding-left: ($gutter-width / 2);
        padding-right: ($gutter-width / 2);
      }
    }
  }
} else { 
  padding-left: 0;
  padding-right: 0;
}

It's breaking change so should be available on 2.0 version

how to use font-face mixin with css modules?

when I paste code like this:

:global {
    @include font-face(Graphik Regular, './fonts/Graphik-Regular', 500);
    @include font-face(Graphik Light, './fonts/Graphik-Light', 300);
    @include font-face(Graphik Medium, './fonts/Graphik-Medium', 500);
    @include font-face(Graphik Semibold, './fonts/Graphik-Semibold', 500);
}

css-modules will remove these lines instead of instert font face

when I paste code like this:

:global {
  html {
    @include font-face(Graphik Regular, './fonts/Graphik-Regular', 500);
    @include font-face(Graphik Light, './fonts/Graphik-Light', 300);
    @include font-face(Graphik Medium, './fonts/Graphik-Medium', 500);
    @include font-face(Graphik Semibold, './fonts/Graphik-Semibold', 500);
  }
}

css modules will generate broken css:

@font-face {
  html {
    font-family: Graphik Regular;
    font-style: normal;
    font-weight: 500;
    src: url(/static/Graphik-Regular.19475240.eot);
    src: url(/static/Graphik-Regular.19475240.eot?#iefix) format('embedded-opentype'),
      url(/static/Graphik-Regular.6253ad31.woff) format('woff'), url(/static/Graphik-Regular.e2a1876e.otf) format('otf'),
      url(/static/Graphik-Regular.cedb86ea.ttf) format('truetype');
    font-family: Graphik Light;
    font-weight: 300;
    src: url(/static/Graphik-Light.b4afb5c4.eot);
    src: url(/static/Graphik-Light.b4afb5c4.eot?#iefix) format('embedded-opentype'), url(/static/Graphik-Light.881624e3.woff)

move some files to todo

these files are not important and will be added after 1.0.0 please remove them

  • /docs/utils.md
  • /docs/units.md
  • docs/transitions.md
  • /docs/typography.md

grid - update description

  • add example how to use gutter in col mixin, and how to disable gutter
  • rename $gutter-widths to $gutter

List of enchancments

  • Always us breakpoint-up - this is good practice
  • svg fonts
  • remove all custom colors - only colors as variable
  • pseudo mixin - remove position
  • reponsive-prop - lack of px

grid doesn't work

.table {
  @include container(true, $gutter: false);
}

.column {
  @include col(1, 7);
}
Module build failed: 
      @error 'Oops! Invalid breakpoint.';
     ^
      Oops! Invalid breakpoint.
      in /node_modules/@7ninjas/scss-mixins/src/_breakpoints.scss (line 33, column 7)

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.