Skip to content

Commit

Permalink
Use Sass “sync” methods for 2x speed up
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Jan 18, 2023
1 parent 6289767 commit 46b9159
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/jest-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const cheerio = require('cheerio')
const { configureAxe } = require('jest-axe')
const nunjucks = require('nunjucks')
const outdent = require('outdent')
const { compileAsync, compileStringAsync } = require('sass')
const { compile, compileString } = require('sass')

const configPaths = require('../config/paths')

Expand Down Expand Up @@ -128,7 +128,7 @@ async function getExamples (componentName) {
* @returns {Promise<import('sass').CompileResult>} Sass compile result
*/
async function renderSass (path, options = {}) {
return compileAsync(path, {
return compile(path, {
loadPaths: [join(configPaths.src, 'govuk')],
quietDeps: true,
...options
Expand All @@ -143,7 +143,7 @@ async function renderSass (path, options = {}) {
* @returns {Promise<import('sass').CompileResult>} Sass compile result
*/
async function renderSassString (source, options = {}) {
return compileStringAsync(source, {
return compileString(source, {
loadPaths: [join(configPaths.src, 'govuk')],
quietDeps: true,
...options
Expand Down
2 changes: 1 addition & 1 deletion tasks/gulp/compile-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ compileStylesheets.displayName = 'compile:scss'
function compileStylesheet (stream, options = {}) {
return stream
.pipe(plumber(errorHandler(stream, 'compile:scss')))
.pipe(sass({ ...options, quietDeps: true }))
.pipe(sass.sync({ ...options, quietDeps: true }))
.pipe(postcss())
.pipe(plumber.stop())
}
Expand Down

0 comments on commit 46b9159

Please sign in to comment.