Skip to content

Commit

Permalink
Use original filepath instead of current type for config.searchPath (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Dec 28, 2021
1 parent 95e485c commit f094a8e
Show file tree
Hide file tree
Showing 10 changed files with 268 additions and 57 deletions.
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'));
});
});

0 comments on commit f094a8e

Please sign in to comment.