Search code examples
cssstylessasscompass-sass

Convert SCSS to SCSS without Compass mixins


I have a SCSS file that references some Compass mixins. Now I want to include it in a project which doesn't use Compass. For that I would like to convert my SCSS with Compass mixins to a SCSS without Compass mixins. Is something like that possible?


Solution

  • I ended up writing myself an Alfred Workflow as file action. Now I can simply action the SCSS file with Compass mixins and I get a normal SCSS file on my Desktop. The bash code looks like this

    export DIR=$(dirname {query})
    export BASE=$(basename {query})
    filename="${BASE%.*}"
    dirname=${filename}$(date +%s)
    
    compass compile --sass-dir ${DIR} --css-dir ~/Desktop/.${dirname}
    sass-convert -F css -T scss ~/Desktop/.${dirname}/${filename}.css ~/Desktop/${filename}.scss
    rm -r ~/Desktop/.${dirname}
    

    The Alfred Workflow is available on GitHub: https://github.com/Juuro/Compass-SCSS-to-SCSS-Alfred-Workflow