diff --git a/docs/contributing/tasks.md b/docs/contributing/tasks.md index c0c1fbcb66..623ecaec16 100644 --- a/docs/contributing/tasks.md +++ b/docs/contributing/tasks.md @@ -39,6 +39,7 @@ npm scripts are defined in `package.json`. These trigger a number of Gulp tasks. - copy Sass files, applying Autoprefixer via PostCSS - copy Nunjucks component template/macro files, including JSON configs - copy GOV.UK Prototype Kit config files +- compile Sass to CSS - compile JavaScript to ECMAScript (ES) modules - compile JavaScript to Universal Module Definition (UMD) bundles - compile Rollup build stats into `./shared/stats/dist` @@ -83,13 +84,6 @@ This task will: - check Sass code quality via Stylelint (`npm run lint:scss`) - compile Sass to CSS into `./packages/govuk-frontend-review/dist/stylesheets` -- compile Sass documentation into `./packages/govuk-frontend-review/dist/docs/sassdoc` - -**`npx --workspace @govuk-frontend/review -- gulp scripts`** - -This task will: - -- compile JavaScript documentation into `./packages/govuk-frontend-review/dist/docs/jsdoc` ## Review app only diff --git a/packages/govuk-frontend/tasks/build/package.unit.test.mjs b/packages/govuk-frontend/tasks/build/package.unit.test.mjs index aa92d5478b..09bc1a2567 100644 --- a/packages/govuk-frontend/tasks/build/package.unit.test.mjs +++ b/packages/govuk-frontend/tasks/build/package.unit.test.mjs @@ -107,6 +107,17 @@ describe('packages/govuk-frontend/dist/', () => { ]) ) + // Only sass package entry is compiled to minified CSS bundle + .flatMap( + mapPathTo(['**/govuk/all.scss'], ({ dir: requirePath }) => [ + join(requirePath, 'all.scss'), + + // CSS bundle, minified + join(requirePath, 'govuk-frontend.min.css'), + join(requirePath, 'govuk-frontend.min.css.map') // with source map + ]) + ) + // Add Autoprefixer prefixes to all source '*.scss' files .flatMap( mapPathTo(['**/*.scss'], ({ dir: requirePath, name }) => [ diff --git a/packages/govuk-frontend/tasks/styles.mjs b/packages/govuk-frontend/tasks/styles.mjs index 835faf2152..9bca8b8533 100644 --- a/packages/govuk-frontend/tasks/styles.mjs +++ b/packages/govuk-frontend/tasks/styles.mjs @@ -1,5 +1,6 @@ import { join } from 'path' +import { pkg } from '@govuk-frontend/config' import { styles, task } from '@govuk-frontend/tasks' import gulp from 'gulp' @@ -10,6 +11,24 @@ import gulp from 'gulp' */ export const compile = (options) => gulp.series( + /** + * Compile GOV.UK Frontend Sass + */ + task.name('compile:scss', () => + styles.compile('all.scss', { + ...options, + + srcPath: join(options.srcPath, 'govuk'), + destPath: join(options.destPath, 'govuk'), + configPath: join(options.basePath, 'postcss.config.mjs'), + + // Rename using package name and `*.min.css` extension + filePath({ dir }) { + return join(dir, `${pkg.name}.min.css`) + } + }) + ), + /** * Apply CSS prefixes to GOV.UK Frontend Sass */