JSPM

svelte-sequential-preprocessor

2.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 57884
  • Score
    100M100P100Q151841F
  • License MIT

Sequential preprocessor for Svelte JS.

Package Exports

  • svelte-sequential-preprocessor
  • svelte-sequential-preprocessor/build/src/main.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (svelte-sequential-preprocessor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Node.js CI new-version Build Status version

svelte-sequential-preprocessor

A Svelte preprocessor that wraps preprocessors to force them to be called sequentially.

Overview

Svelte evaluates preprocessors by running all markup preprocessors first, then script and finally styles. Some preprocesses may not work if other preprocessors haven't been run. For example, svelte-image uses svelte.parse() internally, so svelte-preprocess needs to be run before if any scss is present.

Installation

Using npm:

$ npm i -D svelte-sequential-preprocessor

Usage

With rollup-plugin-svelte

// rollup.config.js
import svelte from 'rollup-plugin-svelte';
import seqPreprocessor from 'svelte-sequential-preprocessor'
import autoPreprocess from 'svelte-preprocess'
import image from 'svelte-image'

export default {
  ...,
  plugins: [
    svelte({
      preprocess: seqPreprocessor([ autoPreprocess(), image() ])
    })
  ]
}

With svelte-loader

  ...
  module: {
    rules: [
      ...
      {
        test: /\.(html|svelte)$/,
        exclude: /node_modules/,
        use: {
          loader: 'svelte-loader',
          options: {
            preprocess: require('svelte-sequential-preprocessor')([ require('svelte-preprocess'), require('svelte-image')])
          },
        },
      },
      ...
    ]
  }
  ...

With Sapper

import seqPreprocessor from 'svelte-sequential-preprocessor';
import autoPreprocess from 'svelte-preprocess'
import image from 'svelte-image'

const preprocess = seqPreprocessor([ autoPreprocess(), image() ]);

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