Skip to content

Commit

Permalink
Merge branch 'v2' into wbinnssmith/multiple-ancestors-wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Binns-Smith committed Apr 8, 2022
2 parents 2bf95ea + 39b330e commit 3b9e574
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
11 changes: 11 additions & 0 deletions packages/core/integration-tests/test/css-modules.js
Expand Up @@ -610,4 +610,15 @@ describe('css modules', () => {
},
]);
});

it('should not process inline <style> elements as a CSS module', async function () {
await bundle(
path.join(__dirname, '/integration/css-modules-style/index.html'),
);
let contents = await outputFS.readFile(
path.join(distDir, 'index.html'),
'utf8',
);
assert(contents.includes('.index {'));
});
});
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<style>
.index {
color: red;
}
</style>
@@ -0,0 +1,6 @@
{
"private": true,
"@parcel/transformer-css": {
"cssModules": true
}
}
Empty file.
7 changes: 4 additions & 3 deletions packages/transformers/css/src/CSSTransformer.js
Expand Up @@ -53,9 +53,10 @@ export default (new Transformer({
filename: path.relative(options.projectRoot, asset.filePath),
code,
cssModules:
config?.cssModules ??
(asset.meta.cssModulesCompiled == null &&
/\.module\./.test(asset.filePath)),
asset.meta.type !== 'tag' &&
(config?.cssModules ??
(asset.meta.cssModulesCompiled == null &&
/\.module\./.test(asset.filePath))),
analyzeDependencies: asset.meta.hasDependencies !== false,
sourceMap: !!asset.env.sourceMap,
drafts: config?.drafts,
Expand Down

0 comments on commit 3b9e574

Please sign in to comment.