0.1.0 • Published 5 years ago
@nsivertsen/svelte-preprocess-postcss v0.1.0
svelte-preprocess-postcss
Svelte preprocessor function for PostCSS.
Install
npm install --save-dev @nsivertsen/svelte-preprocess-postcss
Usage
If you're using the Svelte compiler API directly:
import * as svelte from 'svelte';
import postcss from 'svelte-preprocess-postcss';
const processed = await svelte.preprocess(source, {
style: postcss()
});
If you're using Rollup with rollup-plugin-svelte:
import svelte from 'rollup-plugin-svelte';
import postcss from 'svelte-preprocess-postcss';
export default {
// ...
plugins: [
// ...
svelte({
preprocess: {
style: postcss()
}
}),
// ...
],
// ...
};
API
preprocessorFunction = postcss([context])
svelte-preprocess-postcss
cares about the following keys in context
:
Values | Description | Default | |
---|---|---|---|
useConfigFile | true , false | Whether to load a PostCSS configuration from disk using postcss-load-config | true |
configFilePath | string | The path to your PostCSS config file. If not given, postcss-load-config will look in the current working directory | undefined |
All other keys are passed on to postcss-load-config
. It passes the following keys on to PostCSS if provided:
Values | Description | Default | |
---|---|---|---|
plugins | array | Array of PostCSS plugins | [] |
options | object | PostCSS options | {} |
License
MIT
0.1.0
5 years ago