Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unic/gulp-svg-dimensions
Gulp plugin to parse SVGs and save their dimensions to the file object
https://github.com/unic/gulp-svg-dimensions
Last synced: about 2 months ago
JSON representation
Gulp plugin to parse SVGs and save their dimensions to the file object
- Host: GitHub
- URL: https://github.com/unic/gulp-svg-dimensions
- Owner: unic
- Created: 2015-04-11T21:40:51.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-24T22:31:47.000Z (over 9 years ago)
- Last Synced: 2024-04-14T05:50:41.284Z (9 months ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 1
- Watchers: 23
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gulp-svg-dimensions
Uses [Cheerio](https://www.npmjs.com/package/cheerio) to parse SVGs and add their dimensions (integer values of ```width``` and ```height``` attributes) to the file object (```file.data.dimensions```).
## Usage
First, install `gulp-svg-dimensions` as a development dependency:
```shell
npm install --save-dev gulp-svg-dimensions@git+https://[email protected]/unic/gulp-svg-dimensions.git
```Then, add it to your `gulpfile.js`:
```javascript
var svgDimensions = require('gulp-svg-dimensions');gulp.task('icons', function(){
gulp.src(['app/icons/*.svg'])
.pipe(svgDimensions())
// Some other plugin making use of file.data.dimensions
// e.g. { x:100, y:200 }
.pipe(plugin())
.pipe(gulp.dest('dist/icons/'));
});
```