@roots/bud-extensions
Version:
bud.js core module
31 lines (30 loc) • 1.02 kB
JavaScript
import { __decorate } from "tslib";
import { Extension } from '@roots/bud-framework/extension';
import { label, plugin } from '@roots/bud-framework/extension/decorators';
import FixStyleOnlyEntrypoints from './plugin.js';
/**
* Fix style only entrypoints
*/
let BudFixStyleOnlyEntrypoints = class BudFixStyleOnlyEntrypoints extends Extension {
/**
* When
*/
when(bud) {
if (this.enabled === true)
return true;
if (bud.isDevelopment)
return false;
const entrypoints = bud.hooks.filter(`build.entry`, undefined);
if (!entrypoints)
return false;
if (!Object.values(entrypoints).every(value => value.import.every(entry => entry.endsWith(`.css`)))) {
return false;
}
return true;
}
};
BudFixStyleOnlyEntrypoints = __decorate([
label(`@roots/bud-extensions/fix-style-only-entrypoints`),
plugin(FixStyleOnlyEntrypoints)
], BudFixStyleOnlyEntrypoints);
export default BudFixStyleOnlyEntrypoints;