forked from angularity/node-angularity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
=BG= initial groundwork for spritesheet generation using aslansky/css…
…-sprite - retina spriting out of the box - generates SCSS, however it is insufficient, see aslansky/css-sprite#44 - TODO limitation of generated SCSS can be worked around using a custom template - Base it upon: https://github.com/aslansky/css-sprite/blob/master/lib/templates/scss.mustache - TODO connect to main CSS gulp task - TODO investigate using browserify hooks to look for <i/> tags with classes to determine which files should be sprited
- Loading branch information
Brendan Graetz
authored and
Brendan Graetz
committed
Feb 2, 2015
1 parent
bdaf69b
commit 0f23d12
Showing
4 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
|
||
var gulp = require('gulp'); | ||
var gulpIf = require('gulp-if'); | ||
var gulpNewer = require('gulp-newer'); | ||
var cssSprite = require('css-sprite'); | ||
var through = require('through2'); | ||
var projectOfFile = require('project-of-file'); | ||
|
||
var configStreams = require('../lib/config/streams'); | ||
|
||
gulp.task('identifysprites', [], function() { | ||
|
||
}); | ||
|
||
var projectOfFileInstance = projectOfFile.cachedInstance('angularity-sprite', process.cwd()); | ||
|
||
gulp.task('sprite', [], function() { | ||
return configStreams.imageApp() | ||
// .pipe(gulpNewer(configStreams.BUILD + '/sprite/_sprite.scss')) | ||
.pipe(through.obj(function(file, encoding, done) { | ||
var stream = this; | ||
//Prefix the file name of all images with the project name so as to create | ||
//disambiguation between sprites from mutliple dependencies. | ||
//The need to manipulate file names is inherent from the spriting library | ||
//using file names to generate CSS classes for each sprite. | ||
var projectName = projectOfFileInstance.name(file.path); | ||
file.path = path.join( | ||
process.cwd(), 'sprite', projectName + '--' + path.basename(file.path)); | ||
stream.push(file); | ||
done(/*err*/); | ||
})) | ||
.on('data', function(file) { | ||
}) | ||
.on('end', function() { | ||
}) | ||
.pipe( | ||
cssSprite.stream({ | ||
name: 'sprite', | ||
style: '_sprite.scss', | ||
processor: 'scss', | ||
cssPath: configStreams.BUILD + '/sprite/', | ||
// "generate both retina and standard sprites. src images have to be in retina resolution" | ||
retina: true, | ||
orientation: 'binary-tree', | ||
}) | ||
) | ||
.pipe(gulp.dest(configStreams.BUILD + '/sprite/')); | ||
}); |