Skip to content

cosimomeli/laravel-elixir-svg2png

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel-Elixir-Svg2png

Converts SVG images to PNG using Sharp

Why?

As PHP GD library doesn't support SVG files, I had the need to convert all SVG files to PNG to use them. With this plugin you can add the conversion to your build and deploy pipeline.

Getting Started

Install the module with npm:

$ npm install --save laravel-elixir-svg2png

And add it to your Elixir-enhanced Gulpfile, like so:

var elixir = require('laravel-elixir');

require('laravel-elixir-svg2png');

elixir(function(mix) {
   mix.svg2png('path/to/files/*.svg', 'destination-path');
});

Arguments

svg2png(src, dst, [width, height])

src

The SVG images

dst

The destination path for PNG files

width

The width of destination files (defaults to SVG width)

height

The height of destination files (defaults to SVG height)

Example

This is an example of a Gulp file that runs svg2png to convert all my SVG flags :

var elixir = require('laravel-elixir');
require('laravel-elixir-svg2png');

elixir(function(mix) {
    mix.svg2png('public/flags/*.svg', 'public/png-flags');
});

About

Svg2png wrapper for Laravel Elixir.

Resources

License

Stars

Watchers

Forks

Packages

No packages published