Skip to content

postcss-global-data : set postcss 'from' option #846

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

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/browserslist/package-json/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import plugin from 'postcss-preset-env';
import postcss from 'postcss';

const result = await postcss([plugin()]).process(':any-link { color: blue; }').css;
const result = (await postcss([plugin()]).process(':any-link { color: blue; }')).css;

if (process.env.BROWSERSLIST_ENV === 'production') {
assert.equal(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.8.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@media (min-width: 768px) {
body {
color: green;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@design-tokens url('./tokens.json') format('style-dictionary3');

@custom-media --tablet (min-width: design-token('viewport-tablet' to px));
19 changes: 19 additions & 0 deletions e2e/interop/custom-media--design-tokens--global-data/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@csstools/interop--custom-media--design-tokens--global-data",
"version": "0.0.0",
"private": true,
"description": "Can you use custom-media, design-tokens and global-data together?",
"scripts": {
"build": "postcss style.css -o ./result.css",
"test": "node ./test.mjs"
},
"devDependencies": {
"@csstools/postcss-design-tokens": "file:../../../plugins/postcss-design-tokens",
"@csstools/postcss-global-data": "file:../../../plugins/postcss-global-data",
"postcss-cli": "^10.1.0",
"postcss-custom-media": "file:../../../plugins/postcss-custom-media"
},
"volta": {
"extends": "../../package.json"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default () => ({
map: false,
plugins: {
'@csstools/postcss-global-data': {
files: [
'./media-queries.css',
],
},
'@csstools/postcss-design-tokens': {},
'postcss-custom-media': {},
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@media (min-width: 768px) {
body {
color: green;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@media (--tablet) {
body {
color: green;
}
}
7 changes: 7 additions & 0 deletions e2e/interop/custom-media--design-tokens--global-data/test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import assert from 'assert';
import fs from 'fs/promises';

const result = await fs.readFile('./result.css');
const expect = await fs.readFile('./expect.css');

assert.equal(result.toString(), expect.toString());
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"viewport-tablet": {
"value": 768
}
}
Loading