Created
July 4, 2020 20:30
-
-
Save chrismademe/f42ff1995abca2eae2ddcb1225155b5f to your computer and use it in GitHub Desktop.
Sometimes it can be tidier not to use temporary variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sometimes it can be tidier not to use temporary variables :) | |
// Before | |
async render() { | |
let inputPath = path.join(__dirname, '/assets/css/style.scss'); | |
let { sassOptions } = siteConfig || {}; | |
const { css } = sass.renderSync({ | |
file: inputPath, | |
...sassOptions, | |
}); | |
const output = new cleanCSS({}).minify(css.toString()).styles; | |
return output; | |
} | |
// After | |
async render() { | |
const { css } = sass.renderSync({ | |
file: path.join(__dirname, '/assets/css/style.scss'), | |
...(siteConfig.sassOptions || {}), | |
}); | |
return new cleanCSS({}).minify(css.toString()).styles; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment