Giter Club home page Giter Club logo

sass-css3-mixins's Introduction

By: Matthieu Aussaguel, @mattaussaguel

List of CSS3 Sass Mixins File to be @imported and @included as you need

The purpose of this library is to facilitate the use of CSS3 on different browsers avoiding HARD TO READ and NEVER ENDING css files

Note:All CSS3 Properties are being supported by Safari 5 more info: http://www.findmebyip.com/litmus/#css3-properties

Version

v0.2

Website URL

http://mynameismatthieu.com/sass-css3-mixins/

Mixins available:

Mixins Arguments (with default values)
css3-prefix Will add browser specific prefixes to supplied property (and will set it to supplied value)
background-gradient Start Color: #3C3C3C, End Color: #999999
background-horizontal Start Color: #3C3C3C, End Color: #999999
background-horizontal-inverse Start Color: #999999, End Color: #3C3C3C
background-radial Start Color: #FFFFFF, Start position: 0%, End Color: #000000, End position: 100%
background-size Width: 100%, Height: 100%
background-opacity Color: #000, Opacity: .85
border-radius Radius: 5px
border-radius-separate Top Left: 5px, Top Right: 5px, Bottom Left: 5px, Bottom Right: 5px
box Orientation: horizontal, Pack: center, Align: center
box-rgba R: 60, G: 3, B: 12, Opacity: 0.23, Color: #3C3C3C
box-shadow X: 2px, Y: 2px, Blur: 5px, Color: rgba(0,0,0,.4)
box-sizing Type: border-box
columns Count: 3, Gap: 10
double-borders Color One: #3C3C3C, Color Two: #999999, Radius: 0
flex Value: 1
flip Value: ScaleX: -1
font-face Value: Font Family: myFont, Eot File Src: myFont.eot, Woff File Src: myFont.woff, Ttf File Src: myFont.ttf
opacity Opacity: 0.5
outline-radius Radius: 5px
resize Direction: both
rotate Degree: 0, M11: 0, M12: 0, M21: 0, M22: 0
text-shadow X: 2px, Y: 2px, Blur: 5px, Color: rgba(0,0,0,.4)
transform Parameters: null
transform-style Style: preserve-3d
transition What: all, Length: 1s, Easing: ease-in-out
triple-borders Color One: #3C3C3C, Color Two: #999999, Color Three: #000000, Radius: 0
keyframes Animation name - pass animation css as body
animation name duration timing-function delay iteration-count direction fill-mode play-state (http://www.w3schools.com/cssref/css3_pr_animation.asp)

Examples and Instructions

   // Import the mixins
   @import "css3-mixins.scss"

   // Call Mixins
   @include opacity();
   @include border-radius(3px); 
   @include transition(color, .5s, ease-in);

Changelog

  • Initial Release
  • Beta Release

Licence

Copyright © 2013 Matthieu Aussaguel

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

sass-css3-mixins's People

Contributors

dblaichinger avatar dennis-best avatar domjtalbot avatar hasusuf avatar humancopy avatar makepanic avatar matthieua avatar mjamro avatar oncode avatar richpeniche avatar sarjanen 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

sass-css3-mixins's Issues

Licence?

Any chance of getting an explicit licence added to this?

some ideas and notes

Hey,

this is not really an issue, but some ideas and questions while reading your scss code

  1. what is the advantage of this mixins instead of using "normal" css?
    @mixin text-shadow($x: 2px, $y: 2px, $blur: 5px, $color: rgba(0,0,0,.4)) {
    text-shadow: $x $y $blur $color;
    }
  2. i think the $r, $g, $b vars are to much, you can transform the normal hexcode color to rgb or rgba with background: rgba($color, $opacity);

@mixin box-rgba($r: 60, $g: 3, $b: 12, $opacity: 0.23, $color: #3C3C3C)

  1. i also think the font-face mixins has too much parameters.
    i think its better, when you rename all the fonts with their types to the same name.

e.g. you have arial as webfont, so rename alle the types to the same name (arial.ttf, arial,woff, arial.eot, ...)

@mixin font-face($fontFamily: myFont, $eotFileSrc: 'myFont.eot', $woffFileSrc: 'myFont.woff', $ttfFileSrc: 'myFont.ttf')

so you can have just one src file

and make it like this:
src: url('webfonts/#{$file}.eot'),
url('webfonts/#{$file}.woff') format('woff'),

and so one. Maybe you should add the font-weight as a new parameter.

I hope this is helpful for you.

IE doesn't understand compressed colour codes

Noticed a bug where compressed colour codes generated by using Sass with the --compressed flag (e.g. #ff0 instead of #ff0000) will break microsoft gradient filters as they expect full, 6-digit hex codes. Using sass's built in ie-hex-str() function will fix this:

@mixin background-gradient
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#{ie-hex-str($startColor)}', endColorStr='#{ie-hex-str($endColor)}');

@mixin box-rgba
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#{ie-hex-str($color)}',endColorStr='#{ie-hex-str($color)}');

issue in compiler

sass.compile:
[apply] Syntax error: Invalid CSS after "...'#{$endColor}')": expected expression (e.g. 1px, bold), was ";"
[apply] on line 48 of /home/rttadi/Websites/mitaismain/spring/src/main/webapp/resources/sass/sass-css3-mixins/css3-mixins.sass
[apply] Use --trace for backtrace.

error reading values after opacity

Hi,

I have problem when I compile the lib.
"css3-mixins.scss:196: error: error reading values after opacity"

I added the lib by @import "css3-mixins.scss" into my scss file and use gulp for compile it.

keyframes mixin issue

cannot pass vendor specific content transform, like:

@include keyframes(animation-name) {
    //this content will be same for every vendor
    //so I cannot pass transform or something like that
} 

Opacity issue

I can't get this to compile, get this error:

scss/css3-mixins.scss:188: error reading values after opacity
/* OPACITY */
@mixin opacity($opacity: 0.5) {
    filter:         alpha(opacity=($opacity * 100));
    -ms-filter:     "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + ($opacity * 100) + ")";
    @include css3-prefix('opacity', $opacity);
}

Problem with css3-prefix arguments

I see mixins css3-prefix have 2 arguments, but in some methods calling with more than 2 args.

@include css3-prefix('box-shadow', 0 0 0 1px $colorTwo, 0 0 0 2px $colorThree);
@include css3-prefix('transition', $what: all, $length: 1s, $easing: ease-in-out);

When i tried to use @include transition(); without args, sass fired the error

Mixin css3-prefix doesn't have the following arguments: $what, $length, $easing.

Invalid output from box-shadow mixin

The blank/default $inset parameter in the box-shadow mixin (#1) is producing following invalid output:

-webkit-box-shadow: "" 2px 2px 5px rgba(0, 0, 0, 0.4);
   -moz-box-shadow: "" 2px 2px 5px rgba(0, 0, 0, 0.4);
           box-shadow: "" 2px 2px 5px rgba(0, 0, 0, 0.4);

(sass version: 3.2.9)

I suggest to check if the string is empty:

/* BOX SHADOW */
@mixin box-shadow($x: 2px, $y: 2px, $blur: 5px, $color: rgba(0,0,0,.4), $inset: "") {
  @if ($inset != "") {
    -webkit-box-shadow: $inset $x $y $blur $color;
    -moz-box-shadow:    $inset $x $y $blur $color;
    box-shadow:         $inset $x $y $blur $color;
  } @else {
    -webkit-box-shadow: $x $y $blur $color;
    -moz-box-shadow:    $x $y $blur $color;
    box-shadow:         $x $y $blur $color;
  }
}

Add calc mixin

// Calc
/// @param {} $property Property
/// @param {
} $expression Expression
@mixin calc($property, $expression) {
#{$property}: -moz-calc(#{$expression});
#{$property}: -webkit-calc(#{$expression});
#{$property}: calc(#{$expression});
}

// Calc with default
/// @param {} $property Property
/// @param {
} $default Value
/// @param {*} $expression Expression
@mixin calc-default($property, $default, $expression) {
#{$property}: $default;
#{$property}: -moz-calc(#{$expression});
#{$property}: -webkit-calc(#{$expression});
#{$property}: calc(#{$expression});
}

Invalid output from IE filter

The filter properties for IE in the mixins background-gradient, box-rgba and rotate produce invalid output (the variables are displayed as $xxx in the css).

The right use should be:

filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#{$startColor}', endColorStr='#{$endColor}');

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.