broccoli-rsvg
Advanced tools
Comparing version 0.2.4 to 0.3.0
26
index.js
@@ -5,3 +5,3 @@ 'use strict'; | ||
var CachingWriter = require('broccoli-caching-writer'); | ||
var Rsvg = require('rsvg').Rsvg; | ||
var Rsvg = require('librsvg').Rsvg; | ||
var RSVP = require('rsvp'); | ||
@@ -15,3 +15,3 @@ var path = require('path'); | ||
if (!(this instanceof SvgRenderer)) return new SvgRenderer(inputTree, fileOptions); | ||
this.inputTree = inputTree; | ||
CachingWriter.apply(this, arguments) | ||
this.fileOptions = fileOptions || {}; | ||
@@ -40,3 +40,3 @@ } | ||
SvgRenderer.prototype.getDestFilePath = function(relativePath) { | ||
function getDestFilePath(relativePath) { | ||
return relativePath.replace('svg', 'png'); | ||
@@ -53,3 +53,3 @@ } | ||
allPromises.push(new RSVP.Promise(function(resolve, reject) { | ||
var destPath = path.join(destDir, version['path'] || self.getDestFilePath(relativePath)); | ||
var destPath = path.join(destDir, version['path'] || getDestFilePath(relativePath)); | ||
mkdirp.sync(path.dirname(destPath)); | ||
@@ -62,11 +62,13 @@ render(srcPath, destPath, version, resolve); | ||
SvgRenderer.prototype.updateCache = function(srcDir, destDir) { | ||
SvgRenderer.prototype.updateCache = function(srcPaths, destDir) { | ||
var self = this; | ||
var promises = walkSync(srcDir).map(function(relativePath) { | ||
if (relativePath.slice(-1) === '/') { | ||
mkdirp.sync(path.join(destDir, relativePath)); | ||
} else { | ||
var version = self.fileOptions[relativePath] || {}; | ||
return self.promiseForFile.bind(self)(srcDir, relativePath, destDir, version); | ||
} | ||
var promises = srcPaths.map(function(srcDir) { | ||
return RSVP.all(walkSync(srcDir).map(function(relativePath) { | ||
if (relativePath.slice(-1) === '/') { | ||
mkdirp.sync(path.join(destDir, relativePath)); | ||
} else { | ||
var version = self.fileOptions[relativePath] || {}; | ||
return self.promiseForFile.bind(self)(srcDir, relativePath, destDir, version); | ||
} | ||
})); | ||
}); | ||
@@ -73,0 +75,0 @@ return RSVP.all(promises); |
{ | ||
"name": "broccoli-rsvg", | ||
"description": "SVG to PNG renderer for Broccoli", | ||
"version": "0.2.4", | ||
"author": "Greg V <floatboth@me.com>", | ||
"engines": { | ||
"node": "*" | ||
}, | ||
"main": "index", | ||
"keywords": [ | ||
"broccoli-plugin", | ||
"svg", | ||
"rsvg" | ||
], | ||
"dependencies": { | ||
"broccoli-caching-writer": "^0.3.1", | ||
"mkdirp": "^0.5.0", | ||
"walk-sync": "^0.1.2", | ||
"lodash": "^2.4.1", | ||
"rsvp": "^3.0.6", | ||
"rsvg": "^0.2.5" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/myfreeweb/broccoli-rsvg" | ||
}, | ||
"license": [{ | ||
"type": "WTFPL", | ||
"url": "https://github.com/myfreeweb/broccoli-rsvg/blob/master/COPYING" | ||
}], | ||
"bugs": { | ||
"url": "https://github.com/myfreeweb/broccoli-rsvg/issues" | ||
} | ||
"name": "broccoli-rsvg", | ||
"description": "SVG to PNG renderer for Broccoli", | ||
"version": "0.3.0", | ||
"author": "Greg V <greg@unrelenting.technology>", | ||
"main": "index.js", | ||
"license": "Unlicense", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/myfreeweb/broccoli-rsvg" | ||
}, | ||
"license": [{ | ||
"type": "Unlicense", | ||
"url": "http://unlicense.org" | ||
}], | ||
"bugs": { | ||
"url": "https://github.com/myfreeweb/broccoli-rsvg/issues" | ||
}, | ||
"keywords": [ | ||
"broccoli-plugin", | ||
"svg", | ||
"rsvg" | ||
], | ||
"scripts": { | ||
"test": "mocha test/ --full-trace" | ||
}, | ||
"dependencies": { | ||
"broccoli-caching-writer": "^0.5.5", | ||
"mkdirp": "^0.5.0", | ||
"walk-sync": "^0.1.2", | ||
"lodash": "^3.9.3", | ||
"rsvp": "^3.0.6", | ||
"librsvg": "^0.5.2" | ||
}, | ||
"devDependencies": { | ||
"broccoli": "^0.16.3", | ||
"mocha": "^2.2.5", | ||
"should": "^7.0.1" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# broccoli-rsvg [![npm version](https://img.shields.io/npm/v/broccoli-rsvg.svg?style=flat)](https://www.npmjs.org/package/broccoli-rsvg) [![npm downloads](https://img.shields.io/npm/dm/broccoli-rsvg.svg?style=flat)](https://www.npmjs.org/package/broccoli-rsvg) [![WTFPL](https://img.shields.io/badge/license-WTFPL-brightgreen.svg?style=flat)](https://www.tldrlegal.com/l/wtfpl) | ||
# broccoli-rsvg [![npm version](https://img.shields.io/npm/v/broccoli-rsvg.svg?style=flat)](https://www.npmjs.org/package/broccoli-rsvg) [![npm downloads](https://img.shields.io/npm/dm/broccoli-rsvg.svg?style=flat)](https://www.npmjs.org/package/broccoli-rsvg) [![Build Status](https://img.shields.io/travis/myfreeweb/broccoli-rsvg.svg?style=flat)](https://travis-ci.org/myfreeweb/broccoli-rsvg) [![Dependency Status](https://img.shields.io/gemnasium/myfreeweb/broccoli-rsvg.svg)](https://gemnasium.com/myfreeweb/broccoli-rsvg) [![unlicense](https://img.shields.io/badge/un-license-green.svg?style=flat)](http://unlicense.org) | ||
This [Broccoli][] plugin renders SVG files to PNG using [node-rsvg][]. | ||
This [Broccoli] plugin renders SVG files to PNG using [node-rsvg]. | ||
@@ -70,11 +70,16 @@ [Broccoli]: https://github.com/joliss/broccoli | ||
**Note**: do not pass [broccoli-svgo][] output to rsvg, it might get screwed up. | ||
**Note**: do not pass [broccoli-svgo] output to rsvg, it might get screwed up. | ||
[broccoli-svgo]: https://github.com/sindresorhus/broccoli-svgo | ||
## Contributing | ||
Please feel free to submit pull requests! | ||
Bugfixes and simple non-breaking improvements will be accepted without any questions :-) | ||
By participating in this project you agree to follow the [Contributor Code of Conduct](http://contributor-covenant.org/version/1/1/0/). | ||
## License | ||
Copyright © 2014 [myfreeweb](https://github.com/myfreeweb) | ||
This work is free. You can redistribute it and/or modify it under the | ||
terms of the Do What The Fuck You Want To Public License, Version 2, | ||
as published by Sam Hocevar. See the COPYING file for more details. | ||
This is free and unencumbered software released into the public domain. | ||
For more information, please refer to the `UNLICENSE` file or [unlicense.org](http://unlicense.org). |
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
10371
10
81
85
3
1
2
+ Addedlibrsvg@^0.5.2
+ Addedbindings@1.2.1(transitive)
+ Addedbroccoli-caching-writer@0.5.5(transitive)
+ Addedcore-object@0.0.3(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addedlibrsvg@0.5.2(transitive)
+ Addedlodash@3.10.1(transitive)
+ Addedlodash-node@2.4.1(transitive)
+ Addedms@2.0.0(transitive)
+ Addednan@1.9.0(transitive)
+ Addedpromise-map-series@0.2.3(transitive)
+ Addedsymlink-or-copy@1.3.1(transitive)
- Removedrsvg@^0.2.5
- Removedbroccoli-caching-writer@0.3.1(transitive)
- Removedbroccoli-writer@0.1.1(transitive)
- Removedlodash@2.4.2(transitive)
- Removedminimist@0.0.8(transitive)
- Removedmkdirp@0.4.2(transitive)
- Removedrsvg@0.2.5(transitive)
- Removedrsvp@3.0.21(transitive)
Updatedlodash@^3.9.3