Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@svitejs/svelte-preprocess-svg
Advanced tools
Optimize inline svg in svelte components
npm install --save-dev @svitejs/svelte-preprocess-svg
svelte.config.js
import { sveltePreprocessSvg } from '@svitejs/svelte-preprocess-svg';
//...
export default {
//...
preprocess: [
//...
// sveltePreprocessSvg must be used AFTER other markup preprocessors like mdsvex
sveltePreprocessSvg({
/* options */
})
]
//...
};
export interface SveltePreprocessSvgOptions {
/**
* Filter function to only include some files
*
* @param {PreprocessorInput} input - filename and content of the file to process
* @return boolean true to include the file
*/
include?: (input: PreprocessorInput) => boolean;
/**
* Filter function to exclude some files
*
* @param {PreprocessorInput} input - filename and content of the file to process
* @return boolean true to exclude the file
*/
exclude?: (input: PreprocessorInput) => boolean;
/**
* Array of transformers to apply.
* name: unique name of the transform - this is passed to skipTransform
* transform: function to manipulate svg
*
*/
transforms?: SvgTransform[];
/**
* enable svgo transform, use object for custom svgo options.
* Without custom options it tries to load svgo config or uses defaults
*
* requires svgo to be installed as devDependency
*/
svgo?: boolean | object;
/**
* do not wrap svg content in {@html ``}
*/
disableAtHtml?: boolean;
/**
* skip a transform by name
* @param {PreprocessorInput} input - filename and content of the file to process
* @param {string} transform - name of the transform
* @param {string} svg - the svg to transform (previous transforms are already applied!)
*/
skipTransform?: (input: PreprocessorInput, transform: string, svg: string) => boolean;
/**
* Set to true to use a simple string search instead of svelte.parse.
* This is faster but not fault tolerant. misaligned html comments or svg inside string literals will trip it up
*/
useSimpleStringParser?: boolean;
}
FAQs
Optimize inline svg in svelte components
The npm package @svitejs/svelte-preprocess-svg receives a total of 16 weekly downloads. As such, @svitejs/svelte-preprocess-svg popularity was classified as not popular.
We found that @svitejs/svelte-preprocess-svg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.