Skip to content

Commit

Permalink
feat(styles): build individual components
Browse files Browse the repository at this point in the history
This will allow projects not using Sass to import individual component styles.
  • Loading branch information
gfellerph committed Jul 17, 2024
1 parent 55c2edc commit 78a4f4a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-spies-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Pre-compiled CSS files are now shipped with the package to enable projects not using Sass to selectively import component styles.
21 changes: 21 additions & 0 deletions packages/styles/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,26 @@ gulp.task('sass', () => {
.pipe(gulp.dest(options.outputDir));
});

/**
* Compile components to Css
* - Compile
* - Autoprefix
* - Also puts compiled Css into tsc-out
*/
gulp.task('build-components', () => {
return gulp
.src('./src/components/*.scss')
.pipe(
gulpSass({
outputStyle: 'compressed',
includePaths: options.includePaths,
quietDeps: true,
}),
)
.pipe(gulpPostCss([autoprefixer()]))
.pipe(gulp.dest(`${options.outputDir}/components`));
});

/**
* Generate uncompressed sass output
*/
Expand Down Expand Up @@ -160,5 +180,6 @@ exports.default = gulp.task(
gulp.parallel(
gulp.series('map-icons', 'copy', 'autoprefixer', 'transform-package-json'),
gulp.series('sass'),
gulp.series('build-components'),
),
);

0 comments on commit 78a4f4a

Please sign in to comment.