2021-10-02 02:22:30 +03:00
|
|
|
const autoprefixer = require('autoprefixer')
|
2023-05-12 20:40:35 +03:00
|
|
|
const sass = require('@csstools/postcss-sass')
|
2021-10-02 02:22:30 +03:00
|
|
|
const scss = require('postcss-scss')
|
|
|
|
const scssImport = require('postcss-import')
|
2023-05-31 21:09:16 +03:00
|
|
|
const { join } = require('path')
|
2023-06-09 21:13:04 +03:00
|
|
|
const path = require('path')
|
|
|
|
const fs = require('fs')
|
2021-10-02 02:22:30 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
map: {
|
|
|
|
sourcesContent: false,
|
|
|
|
annotation: true
|
|
|
|
},
|
2021-10-28 20:47:09 +03:00
|
|
|
customSyntax: scss,
|
2021-10-02 02:22:30 +03:00
|
|
|
parser: scss,
|
|
|
|
plugins: [
|
|
|
|
scssImport,
|
|
|
|
sass({
|
|
|
|
includePaths: [join(__dirname, 'node_modules')],
|
|
|
|
outputStyle: process.env.CSS_MINIFY === '0' ? 'expanded' : 'compressed'
|
|
|
|
}),
|
|
|
|
autoprefixer,
|
2023-05-31 21:09:16 +03:00
|
|
|
require('postcss-custom-properties-fallback')({
|
2023-06-09 21:13:04 +03:00
|
|
|
importFrom: [
|
|
|
|
() => {
|
|
|
|
const primitiveFallbacks = [
|
|
|
|
'color-fallbacks.json',
|
|
|
|
'base/size/size.json',
|
|
|
|
'base/typography/typography.json',
|
|
|
|
'functional/size/border.json',
|
|
|
|
'functional/size/breakpoints.json',
|
|
|
|
'functional/size/size-coarse.json',
|
|
|
|
'functional/size/size-fine.json',
|
|
|
|
'functional/size/size.json',
|
|
|
|
'functional/size/viewport.json',
|
|
|
|
'functional/typography/typography.json',
|
|
|
|
]
|
|
|
|
let customProperties = {}
|
|
|
|
for (const filePath of primitiveFallbacks) {
|
|
|
|
const fileData = fs.readFileSync(path.join(__dirname, './node_modules/@primer/primitives/tokens-next-private/fallbacks/', filePath), 'utf8')
|
|
|
|
customProperties = {...customProperties, ...JSON.parse(fileData)}
|
|
|
|
}
|
|
|
|
|
|
|
|
return { customProperties: customProperties };
|
|
|
|
}
|
|
|
|
]
|
2023-05-31 21:09:16 +03:00
|
|
|
}),
|
2021-10-02 02:22:30 +03:00
|
|
|
]
|
|
|
|
}
|