Socket
Socket
Sign inDemoInstall

gatsby-transformer-svg-sprites

Package Overview
Dependencies
273
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

14

gatsby-node.js

@@ -7,3 +7,3 @@ const crypto = require('crypto')

const { Compiler, Image, SpriteSymbol } = require('svg-mixer')
const { extendDefaultPlugins, optimize } = require('svgo')
const { extendDefaultPlugins, optimize: svgoOptimize } = require('svgo')

@@ -35,6 +35,6 @@ const IS_PRODUCTION = process.env.NODE_ENV === 'production'

async function getId (node, cache, minify = IS_PRODUCTION) {
async function getId (node, cache, optimize = IS_PRODUCTION) {
const { contentDigest } = node.internal
if (!minify) {
if (!optimize) {
return `${node.name}--${contentDigest.slice(0, 5)}`

@@ -88,3 +88,3 @@ }

{ cache, getNodesByType },
{ skip: _, plugins: __, minify = IS_PRODUCTION, ...svgMixer }
{ skip: _, plugins: __, optimize = IS_PRODUCTION, ...svgMixer }
) => {

@@ -97,3 +97,3 @@ const content = await createSvg(getNodesByType(NODE_TYPE), svgMixer)

path.resolve('public', filename),
!minify ? content : optimize(content, SVGO_OPTIONS).data
!optimize ? content : svgoOptimize(content, SVGO_OPTIONS).data
)

@@ -124,3 +124,3 @@

exports.onCreateNode = async (helpers, { minify, skip = '' }) => {
exports.onCreateNode = async (helpers, { optimize, skip = '' }) => {
const { node } = helpers

@@ -146,3 +146,3 @@

const content = await loadNodeContent(node)
const id = await getId(node, cache, minify)
const id = await getId(node, cache, optimize)
const spriteSymbol = getSpriteSymbol(id, content)

@@ -149,0 +149,0 @@

{
"name": "gatsby-transformer-svg-sprites",
"description": "Create SVG sprites from GraphQL sources",
"version": "0.0.1",
"version": "0.0.2",
"author": "stldo (https://github.com/stldo)",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -21,3 +21,3 @@ # gatsby-transformer-svg-sprites

options: {
minify: process.env.NODE_ENV === 'production',
optimize: process.env.NODE_ENV === 'production',
skip: '',

@@ -42,3 +42,3 @@ /* ...SVG Mixer options */

### minify
### optimize

@@ -45,0 +45,0 @@ Default: `process.env.NODE_ENV === 'production'`; Type: `boolean`.

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc