Socket
Book a DemoInstallSign in
Socket

svelte-trim

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-trim

Removes unwanted whitespace from the markup section of svelte files.

0.1.0
latest
Source
npmnpm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

svelteTrim

Trims unwanted whitespace out from between <dom nodes="">, <Components />, {tags}, and {#blocks} of svelte files.

Usage:

Place as the last preprocessor in your svelte.config.js's preprocess field. If you us any other preprocessors, wrap them in a call to asMarkupPreprocessor.

Warning! Currently, we must be run on valid/pure svelte files! This means any other preprocessors you use must run before us. Due to how svelte.preprocess works, just placiing them before us will not be enough. You must additionaly wrap them in svelte-as-markup-preprocessor. See their readme for an explanation of why this is necessary.

// svelte.config.js
const {asMarkupPreprocessor} = require('svelte-as-markup-preprocessor')
const sveltePreprocess = require('svelte-preprocess')
const {mdsvex} = require('mdsvex')
const {svelteTrim} = require('svelte-trim')
module.exports = {
  preprocess: [
    asMarkupPreprocessor([
      sveltePreprocess(),
      mdsvex()
    ]),
    svelteTrim({
      removalMethod: 'trim'
      multiline: true,
      inline: false
    })
  ]
}

Call Signature

svelteTrim(passedOptions?: WhitespaceStripperOptions): PreprocessorGroup

Parameters:

Most common options included below. Full list available here.

Option NameTypeDefault
removalMethod'trim'|'comment''trim'
inlinebooleanfalse
multilinebooleantrue
componentSiblingsbooleantrue
elementSiblingsbooleantrue
mustacheBlockSiblingsbooleantrue
mustacheDirectiveSiblingsbooleantrue
mustacheTextSiblingsbooleanfalse
ignoreElementsArray<ElementType>['pre','code','style','script']

Keywords

svelte

FAQs

Package last updated on 30 Oct 2020

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.