Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

handlebars-helper-inlinesvg

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-helper-inlinesvg

Handlebars helper to inline SVGs

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50
Maintainers
1
Weekly downloads
 
Created
Source

handlebars-helper-inlineSVG :bear:

npm version Build Status Coverage Status Dependency Status

Handlebars helper to inline SVGs


Usage

First, add handlebars-helper-inlineSVG as a project dependency using Yarn (or NPM).

yarn add gulp handlebars-helper-inlineSVG

Then register this module as a handlebars helper:

import Handlebars from 'handlebars'; // assumes you have handlebars installed as a project dependency
Handlebars.registerHelper('inlineSVG', inlineSVG);

Then you can inline SVG files from either your local filepaths or from installed packages.

For example to load in a file called test.svg which is in a folder called img in your project you would include the following in your handlebars template:

{{inlineSVG "img/test.svg"}}

Load SVG from a module

To inline an SVG from a module you have installed, you simply need to prefix the module name to the filepath within that module that the SVG is located in:

{{inlineSVG "@justeat/f-icons/src/img/icons/arrows/chevron.svg"}}

Custom Attributes

You can also pass attributes to the root element in your SVG, like so:

{{inlineSVG "img/test.svg" class="myClass" width="100" height="100" }}

Tests

JavaScript tests are located in the test directory at the root of the project.

Keywords

FAQs

Package last updated on 03 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc