Sha256: 45c616e89a2a8d7cd578996c80992330c4397f656ee58cbc259608bda2cff69c

Contents?: true

Size: 693 Bytes

Versions: 1

Compression:

Stored size: 693 Bytes

Contents

const { dirname } = require('path')
const { includePaths } = require('../config')

module.exports = {
  test: /\.(bmp|gif|jpe?g|png|tiff|ico|avif|webp|eot|otf|ttf|woff|woff2|svg)$/,
  exclude: /\.(js|mjs|jsx|ts|tsx)$/,
  type: 'asset/resource',
  generator: {
    filename: (pathData) => {
      const path = dirname(pathData.filename)
      const selectedIncludePath = includePaths.find((includePath) => path.includes(includePath))

      const folders = path
        .replace(`${selectedIncludePath}`, '')
        .split('/')
        .filter(Boolean)

      const foldersWithStatic = ['static', ...folders].join('/')
      return `${foldersWithStatic}/[name]-[hash][ext][query]`
    }
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shakapacker-7.3.0.beta.1 package/rules/file.js