Search code examples
node.jscompass-sasscompassnode-sass

Node-sass can't find Compass imports


Is it possible to use Compass with node-sass? It seems node-sass doesn't know how to import the Compass functions out of the box.

{
  "formatted": "Error: File to import not found or unreadable: compass/css3/box-
shadow\n       Parent style sheet: C:/sandbox/sascar-manager/app/assets/styles/s
ass/project/login.scss\n        on line 1 of sass/project/login.scss\n>> @import
 \"compass/css3/box-shadow\";\n   ^\n",
  "message": "File to import not found or unreadable: compass/css3/box-shadow\nP
arent style sheet: C:/sandbox/app/app/assets/styles/sass/project/logi
n.scss",
  "column": 1,
  "line": 1,
  "file": "C:/sandbox/app/app/assets/styles/sass/project/login.scss",

  "status": 1
}

Solution

  • Compass is a collection of sass mixins and functions plus some Ruby extensions. Node-sass is using a libsass library instead, so the Ruby extensions won't work. However, you'll be able to use most of the Compass functionality using this project.

    Another option is to use Bourbon instead of Compass. It has very similar set of mixins directly available as a npm package.

    See also this quite similar question.