Skip to content

Instantly share code, notes, and snippets.

@chriskyfung
Last active October 26, 2025 03:27
Show Gist options
  • Select an option

  • Save chriskyfung/17832481fccc32f81c116845eec26acd to your computer and use it in GitHub Desktop.

Select an option

Save chriskyfung/17832481fccc32f81c116845eec26acd to your computer and use it in GitHub Desktop.
Backup of css_to_scss.sh from amp-affiliately-jekyll-theme. This shell is a utility to help convert CSS files into the project's standard SCSS format, streamlining style development.
#!/bin/bash
# Directory containing the CSS files
CSS_DIR="./_includes/css"
SCSS_DIR="./_sass"
# Find all .css files in the specified directory, excluding .min.css files
find "$CSS_DIR" -name "*.css" ! -name "*.min.css" | while read -r css_file; do
# Define the corresponding .scss file path
scss_file="${css_file/$CSS_DIR/$SCSS_DIR}"
# Convert the .css file to .scss using sass-convert
sass-convert "$css_file" "${scss_file%.css}.scss"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment