mixins

Sass extend with pseudo selectors

有些话、适合烂在心里 提交于 2019-11-28 01:00:36
问题 I am using compass to manage some sass files on mac osx. I have these files: sass/ screen.scss partials folder/ ... _fonts.scss _functions.scss ... In fonts I have this rule which I would like to reuse @extend. //fonts.scss .icon-ab-logo, { font-family: 'icomoon'; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; } .icon-ab-logo:before { //i want to reuse this. content: "\e000"; } In functions

@ sign and variables in CSS keyframes using LESS CSS

本小妞迷上赌 提交于 2019-11-27 23:02:59
I'm in need of 8 different CSS3 animations which are way too similar, so I used LESS for it. Below is the code, that works perfectly, with one little glitch - the @name variable. .animation_top (@name, @pxFrom, @pxTo) { @-moz-keyframes @name { 0% { top: @pxFrom; opacity: 0; } 100% { top: @pxTo; opacity: 1; } } @-webkit-keyframes @name { 0% { top: @pxFrom; opacity: 0; } 100% { top: @pxTo; opacity: 1; } } @-ms-keyframes @name { 0% { top: @pxFrom; opacity: 0; } 100% { top: @pxTo; opacity: 1; } } } Because css keyframes are started by @ sign, LESS simply ignores the variable of @name. Is there any

Django: Creating a Mixin for Reusable Model Fields

早过忘川 提交于 2019-11-27 17:25:39
问题 I've got a few fields that I want to add to most every model in my project. For example, these fields are "tracking fields" such as a created date, an update date, and an "active" flag. I'm attempting to create a Mixin that I could add to each model class that would allow me to add these extra fields via multiple inheritance. However, when an object instance is created, it appears that my model fields that were added via the Mixin show up as methods of the object rather than database fields.

Mixin vs inheritance

。_饼干妹妹 提交于 2019-11-27 17:25:37
What is the difference between a mixin and inheritance? A Mix in is typically used with multiple inheritance. So, in that sense, there's "no difference". The detail is that a Mix in is rarely useful as a standalone object. For example, say you have a Mix In name "ColorAndDimension", which adds a color property and width and height. Now, you could add ColorAndDimension to a, say, Shape Class, a Sprite Class, a Car Class, etc. And they will all have the same interface (say get/setColor, get/setHeight/Width, etc.) So, in the generic case a Mix in IS inheritance. But you can argue it's a matter of

Difference between @Delegate, @Mixin and Traits in Groovy?

岁酱吖の 提交于 2019-11-27 17:03:17
Would someone explain when I would want to use Groovy Traits vs. Mixins (@Mixin) vs. Delegates (@Delegate)? Maybe some trade-offs and design concerns would help. They all seem to allow for reusing multiple "classes" of behavior. Thanks. :-) This SO thread was helpful too: Difference between @Delegate and @Mixin AST transformations in Groovy Steinar I agree, they all seem to allow reusing multiple "classes" of behaviour. There are differences, though, and understanding these will probably aid your decision. Before providing a brief summary/highlight of each feature and examples of suitable

Inheriting class methods from modules / mixins in Ruby

时光毁灭记忆、已成空白 提交于 2019-11-27 16:56:48
It is known that in Ruby, class methods get inherited: class P def self.mm; puts 'abc' end end class Q < P; end Q.mm # works However, it comes as a surprise to me that it does not work with mixins: module M def self.mm; puts 'mixin' end end class N; include M end M.mm # works N.mm # does not work! I know that #extend method can do this: module X; def mm; puts 'extender' end end Y = Class.new.extend X X.mm # works But I am writing a mixin (or, rather, would like to write) containing both instance methods and class methods: module Common def self.class_method; puts "class method here" end def

Sass Mixin for animation keyframe which includes multiple stages and transform property

好久不见. 提交于 2019-11-27 16:35:23
问题 Here is the standard CSS I am trying to produce but want to use a SASS Mixin to do the work. STANDARD CSS @-webkit-keyframes crank-up { 100% { -webkit-transform: rotate(360deg);} } @-moz-keyframes crank-up { 100% { -moz-transform: rotate(360deg);} } @-o-keyframes crank-up { 100% { -o-transform: rotate(360deg);} } keyframes crank-up { 100% { transform: rotate(360deg);} } I'm using the same mixin as in the following post SASS keyframes not compiling as wanted which is shown below. MIXIN @mixin

Refactoring legacy mixin-based class hierarchies

▼魔方 西西 提交于 2019-11-27 15:54:35
I'm currently working on a huge javascript project which has a huge class hierarchy and heavily uses mixins to extend functionality of base classes. Here is an example of how mixin looks like, we're using compose library to create class-like objects: // Base.js var Base = compose({ setX: function (x) { this.x = x; }, setY: function (y) { this.y = y; }, setPosition: function (x, y) { this.setX(x); this.setY(y); } }) // SameXAndY.js - mixin var SameXAndY = compose({ // Executes after setX in Base.js setX: compose.after(function (x) { this.y = x; }), // Executes after setY in Base.js setY:

How to use Maven 3 mixins?

孤人 提交于 2019-11-27 14:44:01
问题 I was trying to figure out how mixins are defined in Maven 3, but couldn't find anything other than buzz. It is propagated as one of the big new features here and here. I am currently feeling the pain of the hierarchical structure and would like to give it a spin. Does anyone have a pointer to documentation or the source defining the syntax even? 回答1: In a comment to this answer, Brett Porter wrote: Maven 3.0 doesn't offer mixins yet, however. – Brett Porter Feb 16 at 8:18 And AFAIK, mixins

Can I define a LESS mixin to generate a transition-property with a variable number of parameters?

风格不统一 提交于 2019-11-27 13:58:59
问题 I'm introducing LESS to a large web app project to simplify my CSS. I've got a few CSS rules which apply transitions to a varying number of properties, for example: .movable { transition-property: top, left; transition-duration: 0.2s; transition-timing-function: ease; } .fadeAndStretchable { transition-property: opacity, width, height, margin; transition-duration: 1.5s; transition-timing-function: ease-out; } (Note: I've omitted -webkit , -moz and -o properties here for brevity: in reality