Skip to content

Commit

Permalink
feat(element): add standalone styles
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Jan 16, 2023
1 parent 5e01288 commit 284b130
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/build-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ export default async function buildElement() {
cssStylesBundle = proceedReplacements(cssStylesBundle);
cssStylesCore = proceedReplacements(cssStylesCore);

const cssStylesBundleStandalone = cssStylesBundle;
const cssStylesCoreStandalone = cssStylesCore;

const fontStyles = await cleanCss(cssStylesCore.split('/* FONT_END */')[0]);
cssStylesBundle = await cleanCss(cssStylesBundle.split('/* FONT_END */')[1]);
cssStylesCore = await cleanCss(cssStylesCore.split('/* FONT_END */')[1]);
Expand Down Expand Up @@ -119,6 +122,18 @@ export default async function buildElement() {
}),
);

// standalone styles
fs.writeFileSync(path.resolve(outputDir, 'swiper-element.css'), cssStylesCoreStandalone);
fs.writeFileSync(
path.resolve(outputDir, 'swiper-element.min.css'),
await cleanCss(cssStylesCoreStandalone),
);
fs.writeFileSync(path.resolve(outputDir, 'swiper-element-bundle.css'), cssStylesBundleStandalone);
fs.writeFileSync(
path.resolve(outputDir, 'swiper-element-bundle.min.css'),
await cleanCss(cssStylesBundleStandalone),
);

// ESM
fs.copyFileSync('./src/element/get-params.js', path.resolve(outputDir, 'element/get-params.js'));
const elementContent = fs.readFileSync('./src/element/swiper-element.js', 'utf-8');
Expand Down

0 comments on commit 284b130

Please sign in to comment.