Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Update documentation regarding the processor option/feature #106

Open
elycruz opened this issue Sep 17, 2022 · 0 comments
Open

Docs: Update documentation regarding the processor option/feature #106

elycruz opened this issue Sep 17, 2022 · 0 comments
Assignees
Labels
docs Documentation issue. triaged When an issue has been groomed, reproduced, and/or, validated.

Comments

@elycruz
Copy link
Owner

elycruz commented Sep 17, 2022

This feature has a multitude of uses and actually, also, enables Sass variable exports (as pointed out, further below).

Acceptance Criteria

We need to add an example of this to the main README file and additionally add details about different ways to use the processor option .

Example showing how to export sass/css variables to resulting compiled modules (hint: This is done using 'icss-util', and 'postcss' packages) which should be listed processor option docs:

test('should support processor return type `Promise<{css: string, icssExport: {}, icssImport: {}}}>', async t => {
const outputBundle = await rollup({
input: 'test/fixtures/processor-promise/with-icss-exports.js',
plugins: [
sass({
processor: (css) => new Promise((resolve, reject) => {
const pcssRootNodeRslt = postcss.parse(css),
extractedIcss = extractICSS(pcssRootNodeRslt, true),
cleanedCss = pcssRootNodeRslt.toString(),
out = Object.assign({}, extractedIcss.icssExports, {
css: cleanedCss,
});
// console.table(extractedIcss);
// console.log(out);
resolve(out);
}),
options: sassOptions,
}),
],
}),
{output} = await outputBundle.generate(generateOptions),
rslt = squash(unwrap(output));
t.true(rslt.includes(expectA2));
t.true(rslt.includes(expectB));
});

@elycruz elycruz self-assigned this Feb 26, 2023
@elycruz elycruz added the docs Documentation issue. label Feb 26, 2023
@elycruz elycruz added the triaged When an issue has been groomed, reproduced, and/or, validated. label Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue. triaged When an issue has been groomed, reproduced, and/or, validated.
Projects
None yet
Development

No branches or pull requests

1 participant