mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 07:36:42 +08:00
feat(admin): init project (#7197)
This commit is contained in:
@@ -1,4 +1,27 @@
|
||||
const { join } = require('node:path');
|
||||
|
||||
const cssnano = require('cssnano');
|
||||
const tailwindcss = require('tailwindcss');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
|
||||
const { getCwdFromDistribution } = require('../config/cwd.cjs');
|
||||
|
||||
const projectCwd = getCwdFromDistribution(process.env.DISTRIBUTION);
|
||||
|
||||
const twConfig = (function () {
|
||||
try {
|
||||
const config = require(`${projectCwd}/tailwind.config.js`);
|
||||
const { content } = config;
|
||||
if (Array.isArray(content)) {
|
||||
config.content = content.map(c =>
|
||||
c.startsWith(projectCwd) ? c : join(projectCwd, c)
|
||||
);
|
||||
}
|
||||
return config;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
})();
|
||||
|
||||
module.exports = function (context) {
|
||||
const plugins = [
|
||||
@@ -12,6 +35,10 @@ module.exports = function (context) {
|
||||
}),
|
||||
];
|
||||
|
||||
if (twConfig) {
|
||||
plugins.push(tailwindcss(twConfig), autoprefixer());
|
||||
}
|
||||
|
||||
return {
|
||||
from: context.from,
|
||||
plugins,
|
||||
|
||||
Reference in New Issue
Block a user