UNPKG

svelte-preprocess

Version:

A Svelte preprocessor wrapper with baked-in support for commonly used preprocessors

28 lines (27 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.postcss = void 0; const tagInfo_1 = require("../modules/tagInfo"); const utils_1 = require("../modules/utils"); const prepareContent_1 = require("../modules/prepareContent"); /** Adapted from https://github.com/TehShrike/svelte-preprocess-postcss */ const postcss = (options) => ({ async style(svelteFile) { const { transformer } = await import('../transformers/postcss.js'); let { content, filename, attributes, dependencies } = await (0, tagInfo_1.getTagInfo)(svelteFile); content = (0, prepareContent_1.prepareContent)({ options, content }); /** If manually passed a plugins array, use it as the postcss config */ const transformed = await transformer({ content, filename, attributes, options, }); return { ...transformed, dependencies: (0, utils_1.concat)(dependencies, transformed.dependencies), }; }, }); exports.postcss = postcss; exports.default = postcss;