feat: per-entry styles

This commit is contained in:
cha0s 2022-04-02 07:29:28 -05:00
parent ed2aa6a3c1
commit d43316a436
2 changed files with 16 additions and 3 deletions

View File

@ -18,7 +18,7 @@ const augmentBuild = (target, config, flecks) => {
if ('fleck' === target) {
extract.enabled = true;
extract.plugin = {
filename: 'index.css',
filename: '[name].css',
};
}
neutrino.use(

View File

@ -28,9 +28,22 @@ module.exports = async (flecks) => {
const styles = (
await Promise.all(
roots
.map(async ([, path]) => {
.map(([, path]) => {
try {
const {files} = R(join(path, 'package.json'));
return (
files
.filter((name) => name.match(/\.css$/))
.map((name) => join(path, name))
);
}
catch (error) {
return [];
}
})
.flat()
.map(async (filename) => {
try {
const filename = join(path, 'index.css');
await stat(filename);
return filename;
}