All Projects → littlebusters → Sketch Css Sprite Mixin

littlebusters / Sketch Css Sprite Mixin

Generate a code of CSS Sprite Mixin to Clipboard in Sketch.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Sketch Css Sprite Mixin

Sketch Batch Create Symbols
A plugin for Sketch to convert selected layers to individual symbols.
Stars: ✭ 134 (+27.62%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
Sketch Commands
A collection of script commands for Sketch.app
Stars: ✭ 826 (+686.67%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
Overrideit Sketchplugin
Overrideit is sketch plugin that allow designers to search in overridelist and overrides dropdowns, and with many other features.
Stars: ✭ 113 (+7.62%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
Sketch Find And Replace
Sketch plugin to do a find and replace on text within layers
Stars: ✭ 693 (+560%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
Ishadow
Creating a beautiful iOS style shadow [Sketch Plugin]
Stars: ✭ 89 (-15.24%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
Artboard Manager
Because moving Artboards manually is *so* 2016
Stars: ✭ 672 (+540%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
Camilo
Sketch plugin specially crafted to work in Design systems with multiple themes
Stars: ✭ 175 (+66.67%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
Notes
A sketch plugin for taking notes
Stars: ✭ 87 (-17.14%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
Svgo Compressor
A Plugin that compresses SVG assets using SVGO, right when you export them.
Stars: ✭ 1,068 (+917.14%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
sketch-action-api-tester
A plugin to listen to all the events in the Action API
Stars: ✭ 26 (-75.24%)
Mutual labels:  sketch-plugin, sketch-app, sketchapp
Sketchcrapp
SketchCrapp - Crack your Sketch.app in seconds :) Supports MacOS Big Sur.
Stars: ✭ 218 (+107.62%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
Keys For Sketch
Advanced shortcut manager for Sketch app.
Stars: ✭ 281 (+167.62%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
autopdfexporter-sketch-plugin
A Sketch Plugin to auto-export all '[S]' Prefix artboards to a single pdf, no slices needed! Plugin auto creates slices from prefixed Artboards and exports them into a single page-sorted pdf file.
Stars: ✭ 16 (-84.76%)
Mutual labels:  sketch-plugin, sketch-app, sketchapp
Sketch Image Compressor
A Plugin for Sketch that compresses your bitmap assets, to keep filesize to a minimum.
Stars: ✭ 338 (+221.9%)
Mutual labels:  sketch-app, sketchapp, sketch-plugin
Cleanup Useless Groups
A Sketch plugin that cleans up your layer list by removing empty groups and flattening deeply nested groups.
Stars: ✭ 100 (-4.76%)
Mutual labels:  sketch-app, sketch-plugin
Html Sketchapp Cli
Quickly generate Sketch libraries from HTML documents and living style guides, powered by html-sketchapp
Stars: ✭ 631 (+500.95%)
Mutual labels:  sketchapp, sketch-plugin
Sketch Map Generator
Sketch plugin to fill a shape with a map generated from a given location using Google Maps and Mapbox
Stars: ✭ 824 (+684.76%)
Mutual labels:  sketchapp, sketch-plugin
Sketch Guides
Add Guides to edges and midpoints at once.
Stars: ✭ 83 (-20.95%)
Mutual labels:  sketch-app, sketch-plugin
Slinky
Export your Sketch designs as HTML email templates
Stars: ✭ 604 (+475.24%)
Mutual labels:  sketch-app, sketch-plugin
Renamer
Sketch Plugin to rename multiple selected layers or groups or artboards at once
Stars: ✭ 16 (-84.76%)
Mutual labels:  sketch-app, sketch-plugin

Sketch CSS Sprite Mixin

Generate a code of mixin for scss, less and stylus in Sketch. Code is copied to the clipboard when run the plugin.

Sprites name are group layer name of top-level, and the Sprite image name is an Artboard name.

Usage

  1. Select Artboard.
  2. Choose Plugins › Sketch Css Sprite Mixin › (Scss|Sass|Less|Stylus).
  3. Genarated code to Clipboard.

Screen Shot

SCSS

@mixin cssSprite( $spriteVals ) {
	width: nth( $spriteVals, 1 );
	height: nth( $spriteVals, 2 );
	background-repeat: no-repeat;
	background-image: url( #{ nth( $spriteVals, 3 ) } );
	background-position: nth( $spriteVals, 4 ) nth( $spriteVals, 5 );
	@media only screen and ( -webkit-min-device-pixel-ratio: 2 ), only screen and ( min-device-pixel-ratio: 2 ) {
		background-image: url( #{ nth( $spriteVals, 6 ) } );
		background-size: $bgiSizeW $bgiSizeH;
	}
}
$icon-spritePath: '../img/icon-sprite';
$icon-spriteURL: $icon-spritePath + '.png';
$icon-spritex2URL: $icon-spritePath + '@2.png';
$bgiSizeW: 200px;
$bgiSizeH: 200px;
$instagram: 64px 64px $icon-spriteURL -100px -100px $icon-spritex2URL;
$pinterest: 64px 64px $icon-spriteURL 0px -100px $icon-spritex2URL;
$facebook: 64px 64px $icon-spriteURL -100px 0px $icon-spritex2URL;
$twitter: 64px 64px $icon-spriteURL 0px 0px $icon-spritex2URL;
$icon-spriteList: $instagram instagram, $pinterest pinterest, $facebook facebook, $twitter twitter;
@each $icon in $icon-spriteList {
	$icon-spriteName: nth( $icon, 2 );
	$icon-spriteClass: nth( $icon, 1 );
	.icon-#{$icon-spriteName} {
		@include cssSprite( $icon-spriteClass );
	}
}

Sass

=cssSprite( $spriteVals )
	width: nth( $spriteVals, 1 )
	height: nth( $spriteVals, 2 )
	background-repeat: no-repeat
	background-image: url( #{ nth( $spriteVals, 3 ) } )
	background-position: nth( $spriteVals, 4 ) nth( $spriteVals, 5 )
	@media only screen and ( -webkit-min-device-pixel-ratio: 2 ), only screen and ( min-device-pixel-ratio: 2 ) 
		background-image: url( #{ nth( $spriteVals, 6 ) } )
		background-size: $bgiSizeW $bgiSizeH
	

$icon-spritePath: '../img/icon-sprite'
$icon-spriteURL: $icon-spritePath + '.png'
$icon-spritex2URL: $icon-spritePath + '@2.png'
$bgiSizeW: 200px
$bgiSizeH: 200px
$instagram: 64px 64px $icon-spriteURL -100px -100px $icon-spritex2URL
$pinterest: 64px 64px $icon-spriteURL 0px -100px $icon-spritex2URL
$facebook: 64px 64px $icon-spriteURL -100px 0px $icon-spritex2URL
$twitter: 64px 64px $icon-spriteURL 0px 0px $icon-spritex2URL
$icon-spriteList: $instagram instagram, $pinterest pinterest, $facebook facebook, $twitter twitter
@each $icon in $icon-spriteList 
	$icon-spriteName: nth( $icon, 2 )
	$icon-spriteClass: nth( $icon, 1 )
	.icon-#{$icon-spriteName} 
		+cssSprite( $icon-spriteClass )

Less

.cssSprite( @spriteVals ) {
	width: extract( @spriteVals, 1 );
	height: extract( @spriteVals, 2 );
	background-repeat: no-repeat;
	background-image: e( %( 'url(%s)', extract( @spriteVals, 3 ) ) );
	background-position: extract( @spriteVals, 4 ) extract( @spriteVals, 5 );
	@media only screen and ( -webkit-min-device-pixel-ratio: 2 ), only screen and ( min-device-pixel-ratio: 2 ) {
		background-image: e( %( 'url(%s)', extract( @spriteVals, 6 ) ) );
		background-size: @bgiSizeW @bgiSizeH;
	}
}
@icon-spritePath: '../img/icon-sprite';
@icon-spriteURL: '@{icon-spritePath}.png';
@icon-spritex2URL: '@{icon-spritePath}@2.png';
@bgiSizeW: 200px;
@bgiSizeH: 200px;
@instagram: 64px 64px @icon-spriteURL -100px -100px @icon-spritex2URL;
@pinterest: 64px 64px @icon-spriteURL 0px -100px @icon-spritex2URL;
@facebook: 64px 64px @icon-spriteURL -100px 0px @icon-spritex2URL;
@twitter: 64px 64px @icon-spriteURL 0px 0px @icon-spritex2URL;
@icon-spriteList: @instagram instagram, @pinterest pinterest, @facebook facebook, @twitter twitter;
@spriteCounter: length( @icon-spriteList );
.cssSpriteBuilder( @spriteCounter ) when ( @spriteCounter > 0 ) {
	.cssSpriteBuilder(( @spriteCounter - 1 ));
	@icon: extract( @icon-spriteList, @spriteCounter );
	@icon-spriteName: extract( @icon, 2 );
	@icon-spriteClass: extract( @icon, 1 );
	[email protected]{icon-spriteName} {
		.cssSprite( @icon-spriteClass );
	}
}
.cssSpriteBuilder( @spriteCounter );

Stylus

cssSprite( $spriteVals )
	width: $spriteVals[0]
	height: $spriteVals[1]
	background-repeat: no-repeat
	background-image: url( $spriteVals[2] )
	background-position: $spriteVals[3] $spriteVals[4]
	@media only screen and ( -webkit-min-device-pixel-ratio: 2 ), only screen and ( min-device-pixel-ratio: 2 ) 
		background-image: url( $spriteVals[5] )
		background-size: $bgiSizeW $bgiSizeH
	

$icon-spritePath = '../img/icon-sprite'
$icon-spriteURL = $icon-spritePath + '.png'
$icon-spritex2URL = $icon-spritePath + '@2.png'
$bgiSizeW = 200px
$bgiSizeH = 200px
$instagram = 64px 64px $icon-spriteURL -100px -100px $icon-spritex2URL
$pinterest = 64px 64px $icon-spriteURL 0px -100px $icon-spritex2URL
$facebook = 64px 64px $icon-spriteURL -100px 0px $icon-spritex2URL
$twitter = 64px 64px $icon-spriteURL 0px 0px $icon-spritex2URL
$icon-spriteList = $instagram instagram, $pinterest pinterest, $facebook facebook, $twitter twitter
for $icon in $icon-spriteList 
	$icon-spriteName = $icon[1]
	$icon-spriteClass = $icon[0]
	.icon-{$icon-spriteName} 
		cssSprite( $icon-spriteClass )

Installation

with Sketch Runner

With Sketch Runner, just go to the install command and search for css sprite mixin. Runner allows you to manage plugins and do much more to speed up your workflow in Sketch. Download Runner here.

with Sketchpacks

You can find this plugin in "Sketchpacks". Type css sprite mixin on the search box, then you click "INSTALL" button.

with Manualy

Or, Download the plugin zip and unzip. Double-click the Sketch CSS Sprite Mixin.sketchplugin in the folder to install it.

License

The MIT License (MIT)

(c) 2014

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].