assetgraph / assetgraph-sprite Goto Github PK
View Code? Open in Web Editor NEWAssetGraph plugin for creating sprites from background images
License: BSD 3-Clause "New" or "Revised" License
AssetGraph plugin for creating sprites from background images
License: BSD 3-Clause "New" or "Revised" License
See this discussion: https://twitter.com/rachelnabors/status/573232079900581889
Resources: https://github.com/rachelnabors/pet-rachel https://github.com/rachelnabors/pet-rachel/blob/master/scss/_mixins.scss
http://rachelnabors.com/blackbrickroad/ and the style sheet is important: http://rachelnabors.com/blackbrickroad/css/styles.css
Example from stylesheet:
/* line 112, ../sass/_mixins.scss */
.photo7-scrap2 {
background-position: 0 97.41567%;
width: 1.15321%;
padding-top: 1.15321%;
height: 0;
left: 16.72158%;
top: 77.35%;
-moz-background-size: 6171.42857% auto;
-o-background-size: 6171.42857% auto;
-webkit-background-size: 6171.42857% auto;
background-size: 6171.42857% auto;
}
/* line 123, ../sass/_mixins.scss */
.photo7 .scrap2 {
background-position: 0 97.18663%;
width: 71.16969%;
padding-top: 22.40527%;
height: 0;
left: 13.34432%;
top: 16.35%;
-moz-background-size: 100% auto;
-o-background-size: 100% auto;
-webkit-background-size: 100% auto;
background-size: 100% auto;
}
This package might be interesting in order to avoid cairo as an OS dependency of assetgraph-sprite: https://github.com/LearnBoost/node-canvas/wiki/Installation-on-Heroku#using-a-fork-of-node-canvas
When the background-size
of the individual image is <percentage>
, cover
, contain
or inherit
we should not include the image in the sprite sheet and instead emit a warning.
Refs #13
I've fixed some problems with wrong sprite positioning when there is added padding and there is a previous background positioning in the selector. See e3fe75b
Please publish a new version
I found this: https://github.com/unfold/spriter/blob/master/lib/renderers/packer.js
The project it comes from is quite good as well.
When building sprites so far these two vendor specific selectors, which are only there for assetgraph-sprite, don't get removed from the resulting CSS:
-one-allow-selector-merge:true;
-one-sprite-selector:.icon;
We might want to kill every property starting with -one- before outputting to production.
I have a setup where sprite sheets are defined in sass files that are included in multiple other toplevel sass files. The result is that each output css file has a redefinition of the same sprite sheet. I hit the "Multiple definitions of spriteGroupName
sprite"-error.
Is there a way to avoid this?
Ideally I'd want assetgraph-sprite to handle this case more gracefully, but I'm also ok with having to do some manual workarounds in my assetgraph transform queue.
What about pixel density? I have @2x
images and I can't get assetgraph-sprite to calculate the position right. Could it perhaps read the @2x
filename suffix or optional background-size
rules from the CSS to determine image dimensions?
Assetgraph got a major API revision in 6c23f75
Assetgraph-sprite got adapted to the new API in 2190980
Assetgraph got released after the API changes, but assetgraqph-sprite didn't.
This breaks assetgraph-builder from v1.3.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.