• sass编译


    sass编译

    命令行编译

    单文件转换命令

    sass style.scss style.css

    单文件监听命令

    sass --watch style.scss:style.css

    文件夹监听命令

    sass --watch sassFileDirectory:cssFileDirectory

    css文件转成sass/scss文件(在线转换工具css2sass

    sass-convert style.css style.sass   
    sass-convert style.css style.scss
    

    命令行其他配置选项

    运行命令行帮助文档,可以获得所有的配置选项

    sass -h

    我们一般常用的有--style--sourcemap--debug-info等。

    sass --watch style.scss:style.css --style compact
    sass --watch style.scss:style.css --sourcemap
    sass --watch style.scss:style.css --style expanded --sourcemap
    sass --watch style.scss:style.css --debug-info
    
    • --style表示解析后的css是什么格式,有四种取值分别为:nestedexpandedcompactcompressed
    • --sourcemap表示开启sourcemap调试。开启sourcemap调试后,会生成一个后缀名为.css.map文件。
    • --debug-info表示开启debug信息,升级到3.3.0之后因为sourcemap更高级,这个debug-info就不太用了。

    四种style生成后的css

    // nested
    #main {
      color: #fff;
      background-color: #000; }
      #main p {
        width: 10em; }
    
    .huge {
      font-size: 10em;
      font-weight: bold;
      text-decoration: underline; }
    
    // expanded
    #main {
      color: #fff;
      background-color: #000;
    }
    #main p {
      width: 10em;
    }
    
    .huge {
      font-size: 10em;
      font-weight: bold;
      text-decoration: underline;
    }
    
    // compact
    #main { color: #fff; background-color: #000; }
    #main p { width: 10em; }
    
    .huge { font-size: 10em; font-weight: bold; text-decoration: underline; }
    
    // compressed
    #main{color:#fff;background-color:#000}#main p{10em}.huge{font-size:10em;font-weight:bold;text-decoration:underline}

    gui编译

    这里推荐koala,它是一个优秀的免费编译器,界面清晰简洁,操作起来也非常简单,详细的大家可以移歩到:Less/Sass编译工具,koala使用指南,简单操作如下图:

    koala compile

    编辑器编译

    某些高上大的编辑器本身就内置了sass的编译,如webstorm等,而对于sublime text也有相应的插件可以使用:编译保存即编译。如果不清楚你的编辑器是否拥有自动编译的功能,可谷歌百度。

    在线编译

    sassmeister提供了在线编译。

    文章内容源于网络

  • 相关阅读:
    细说 ASP.NET Cache 及其高级用法【转】
    类变量和实例变量的区别是什么?
    【转】细说Cookie
    【转】细说 Form (表单)
    PHP API中,MYSQL与MYSQLI的持久连接区别
    Extending_and_embedding_php翻译
    linux常见面试题及答案
    手机辐射查询
    php5.3 PHP5.4 PHP5.5 新特性/使用PHP5.5要注意的
    sqoop安装遇到的问题
  • 原文地址:https://www.cnblogs.com/xinlecnblogs/p/6091167.html
Copyright © 2020-2023  润新知