diff --git a/.changeset/proud-spies-tap.md b/.changeset/proud-spies-tap.md new file mode 100644 index 0000000000..5b6cbaf3bc --- /dev/null +++ b/.changeset/proud-spies-tap.md @@ -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. diff --git a/packages/styles/gulpfile.js b/packages/styles/gulpfile.js index eb72c4b454..6151f05e7c 100644 --- a/packages/styles/gulpfile.js +++ b/packages/styles/gulpfile.js @@ -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 */ @@ -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'), ), );