sass install

sass install

  1. ruby install

    1
    2
    3
    4
    5
    6
    7
    8
    [root@dev ~]# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
    [root@dev ~]# curl -sSL https://get.rvm.io | bash -s stable
    [root@dev ~]# source /etc/profile.d/rvm.sh
    [root@dev ~]# sed -i 's!ftp.ruby-lang.org/pub/ruby!cache.ruby-china.org/pub/ruby!g' $rvm_path/config/db

    [root@dev ~]# rvm install 2.4
    [root@dev ~]# rvm --default use 2.4
    [root@dev ~]# gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
  2. sass install

    1
    2
    3
    4
    5
    6
    7
    [root@dev ~]# gem install sass
    [root@dev ~]# gem install compass

    [root@dev ~]# sass -v
    Sass 3.4.25 (Selective Steve)
    [root@dev ~]# compass -v
    Compass 1.0.3 (Polaris)
  3. sass 编译

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    [root@dev ~]# sass input.scss output.css  //单文件转换命令
    [root@dev ~]# sass --watch input.scss:output.css //单文件监听命令
    [root@dev ~]# sass --watch app/sass:public/stylesheets //sass监听整个目录

    [root@dev ~]# sass --watch input.scss:output.css --style compact //编译格式
    [root@dev ~]# sass --watch input.scss:output.css --sourcemap //编译添加调试map
    [root@dev ~]# sass --watch input.scss:output.css --style expanded --sourcemap //选择编译格式并添加调试map
    [root@dev ~]# sass --watch input.scss:output.css --debug-info //开启debug信息

    注意:
    1.sass内置有四种编译格式:nested``expanded``compact``compressed
    2.-sourcemap表示开启sourcemap调试.开启sourcemap调试后,会生成一个后缀名为.css.map文件