How do I make Sass work?

前端 未结 1 1586
小鲜肉
小鲜肉 2020-12-02 00:40

This might be a dumb question but I stumbled upon this awesome CodePen that I wanted to adjust and use. I launched a quick demo on my own server but it didn\'t work. Then I

相关标签:
1条回答
  • 2020-12-02 01:09

    The matter is that you have to compile your SCSS into CSS. There are no browsers that support Sass: you must compile it first with a Sass compiler and then link to the compiled CSS. Codepen does that for you automatically.

    How to compile Sass

    There are two common ways to compile Sass, both of them automatically compile your code whenever you make changes to it:

    • Use the sass command line tool that comes with the Sass gem
    • Use some GUI tool like CodeKit or Compass.App

    It's worth noting that Codepen compiles using Compass, which I recommend using rather than the vanilla Sass compiler. In addition to providing extra functions and a library of useful mixins, it uses a configuration file (config.rb) file so that you just have to run the compass watch command to compile on the fly as you code.

    This sounds like a bit of a hassle, but it's worth your while. Compass leverages Sass to a whole new level with it's library of mixins and an ecosystem of Compass extensions: grid systems, tools to make your site responsive, handy shortcuts and tools.

    0 讨论(0)
提交回复
热议问题