Lego2012
7/5/2017 - 1:37 PM

Prepare CSS Files with Bower for SCSS Import

Prepare CSS Files with Bower for SCSS Import

Solution using bower to prepare css files for sass importing. This works only if Bower installs components. After that if nothing is installed the script will not execute (therefore its name .bower-postinstall.sh):

bower.json

    devDependencies: {
        "normalize.css" : "latest"
    }

.bowerrc

{
    "scripts": {
        "postinstall": "./.bower-postinstall"
    }
}

.bower-postinstall

#!/bin/sh

mv bower_components/normalize.css/normalize.css bower_components/normalize.css/_normalize.scss

sass/main.scss

@import '../../bower_components/normalize.css/normalize';