UNPKG

@terrazzo/plugin-sass

Version:

Generate scss/sass from your design tokens schema (requires @terrazzo/cli)

45 lines 1.99 kB
/** * @module @terrazzo/plugin-sass * @license MIT License * * Copyright (c) 2021 Drew Powers * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import build from './build.js'; export * from './lib.js'; export default function pluginSass(options) { const filename = options?.filename ?? 'index.scss'; return { name: '@terrazzo/plugin-sass', enforce: 'post', config(config) { // plugin-css is required for transforms. throw error if (!config.plugins.some((p) => p.name === '@terrazzo/plugin-css')) { throw new Error(`@terrazzo/plugin-sass relies on @terrazzo/plugin-css. Please install @terrazzo/plugin-css and follow setup to add to your config.`); } }, async build({ getTransforms, outputFile }) { const output = build({ getTransforms, options }); outputFile(filename, output); }, }; } //# sourceMappingURL=index.js.map