Skip to content

Instantly share code, notes, and snippets.

@chrismademe
Created July 4, 2020 20:30
Show Gist options
  • Save chrismademe/f42ff1995abca2eae2ddcb1225155b5f to your computer and use it in GitHub Desktop.
Save chrismademe/f42ff1995abca2eae2ddcb1225155b5f to your computer and use it in GitHub Desktop.
Sometimes it can be tidier not to use temporary variables
// 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