Skip to content

Instantly share code, notes, and snippets.

@shivanarrthine
Last active July 27, 2020 11:02
Show Gist options
  • Save shivanarrthine/35e6d0d90f722a61b775a083f891dfba to your computer and use it in GitHub Desktop.
Save shivanarrthine/35e6d0d90f722a61b775a083f891dfba to your computer and use it in GitHub Desktop.
Simple npm setup to compile and post-process Sass files. Use by running `npm run watch-css`
{
"scripts": {
"build-css": "node-sass --include-path --source-map scss public/sass/application.sass public/css/styles.css",
"post-css": "npx postcss public/css/styles.css --config postcss.config.js -o public/css/styles.min.css",
"watch-css": "nodemon -e sass -x \"npm run build-css && npm run post-css\""
}
}
// Node modules required: node-sass, nodemon, postcss-cli, autoprefixer, cssnano
// Setup guide: https://www.notion.so/Simple-npm-setup-to-compile-and-post-process-Sass-files-267dd76552de48359718c23b99259864
module.exports = {
plugins: [
require('autoprefixer'),
require('cssnano')({
preset: 'default',
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment