svelte-trim-whitespace-preprocessor

Svelte Trim Whitespace Preprocessor

Trim whitespace between inline elements in Svelte components

svelte-trim-whitespace-preprocessor

Trim whitespace between inline elements in Svelte components

Install via

npm i -D svelte-trim-whitespace-preprocessor

Then, wherever you preprocess Svelte components, add the imported object. Here is an example with the Rollup config:


import trimWhitespacePreprocessor from 'svelte-trim-whitespace-preprocessor';

export default {
    client: {
    // ...
    plugins: [
      svelte({
              // ...
        preprocess: trimWhitespacePreprocessor
      })
        ]    
  },
  server: {
    // ...
    plugins: [
      svelte({
              // ...
        preprocess: trimWhitespacePreprocessor
      })
        ]    
  }
}

Here it is in code:

svelte.preprocess(content, trimWhitespacePreprocessor, {filename});

Top categories

svelte logo

Want a Svelte site built?

Hire a Svelte developer
Loading Svelte Themes