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

Use original filepath instead of current type for config.searchPath #7448

Merged
merged 3 commits into from Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions packages/core/core/src/Transformation.js
Expand Up @@ -587,11 +587,7 @@ export default class Transformation {
);

for (let transformer of transformers) {
let config = await this.loadTransformerConfig(
filePath,
transformer,
isSource,
);
let config = await this.loadTransformerConfig(transformer, isSource);
if (config) {
this.configs.set(transformer.name, config);
}
Expand Down Expand Up @@ -650,7 +646,6 @@ export default class Transformation {
}

async loadTransformerConfig(
filePath: ProjectPath,
transformer: LoadedPlugin<Transformer<mixed>>,
isSource: boolean,
): Promise<?Config> {
Expand All @@ -662,7 +657,7 @@ export default class Transformation {
let config = createConfig({
plugin: transformer.name,
isSource,
searchPath: filePath,
searchPath: this.request.filePath,
env: this.request.env,
});

Expand Down
2 changes: 2 additions & 0 deletions packages/core/integration-tests/package.json
Expand Up @@ -12,6 +12,7 @@
"test-ci": "yarn test --reporter mocha-multi-reporters --reporter-options configFile=./test/mochareporters.json"
},
"devDependencies": {
"autoprefixer": "^10.4.0",
"@babel/core": "^7.12.0",
"@babel/plugin-syntax-class-properties": "^7.12.1",
"@babel/plugin-syntax-export-default-from": "^7.2.0",
Expand Down Expand Up @@ -52,6 +53,7 @@
"react-dom": "^16.11.0",
"rimraf": "^2.6.1",
"sugarss": "^3.0.3",
"tailwindcss": "^3.0.2",
"tempy": "^0.3.0",
"ws": "^7.0.0"
}
Expand Down
@@ -0,0 +1,7 @@
const path = require("path");

module.exports = {
plugins: [
require('tailwindcss')(path.resolve(__dirname, "tailwind.config.js")),
]
}
@@ -0,0 +1,8 @@
<html>
<head>
<link rel="stylesheet" href="index.scss">
</head>
<body class="p-2">
test
</body>
</html>
@@ -0,0 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

body {
@apply p-4 m-4;
}
@@ -0,0 +1,3 @@
{

}
@@ -0,0 +1,9 @@
const path = require("path");

module.exports = {
content: [path.join(__dirname, "index.html")],
theme: {
extend: {},
},
plugins: [],
};
Empty file.
17 changes: 17 additions & 0 deletions packages/core/integration-tests/test/tailwind-tests.js
@@ -0,0 +1,17 @@
import assert from 'assert';
import path from 'path';
import {bundle, outputFS} from '@parcel/test-utils';

describe('tailwind', function () {
it('should support tailwind from SCSS', async function () {
let fixture = path.join(__dirname, '/integration/tailwind-scss');
let b = await bundle(path.join(fixture, 'index.html'));

let css = await outputFS.readFile(
b.getBundles().find(b => b.type === 'css').filePath,
'utf8',
);
assert(css.includes('.p-2'));
assert(!css.includes('.m-2'));
});
});