diff --git a/index.js b/index.js index 6e32b7e..c59b574 100644 --- a/index.js +++ b/index.js @@ -55,6 +55,8 @@ module.exports = function (options = {}) { ); } compilerOptions.css = cssOptionValue; + } else if (majorVersion > 4) { + compilerOptions.css = 'injected'; } return { diff --git a/test/index.js b/test/index.js index e485327..5c96695 100644 --- a/test/index.js +++ b/test/index.js @@ -114,6 +114,25 @@ test('respects `sourcemapExcludeSources` Rollup option', async () => { assert.is(map.sourcesContent, null); }); +test('injects CSS with `emitCss: false', async () => { + const p = plugin({emitCss: false}); + + const transformed = await p.transform( + ` +

Hello!

+ + + `, + 'test.svelte' + ); + + assert.ok(transformed.code.includes('color:red')); +}); + test('squelches "unused CSS" warnings if `emitCss: false`', () => { const p = plugin({ emitCss: false,