美文网首页
入门Sass——编译

入门Sass——编译

作者: 俗三疯 | 来源:发表于2017-09-05 08:50 被阅读8次

命令行编译

//单文件转换命令
sass input.scss output.css

//单文件监听命令
sass --watch input.scss:output.css

//如果你有很多的sass文件的目录,你也可以告诉sass监听整个目录:
sass --watch app/sass:public/stylesheets


命令行编译配置选项

//编译格式
sass --watch input.scss:output.css --style compact

//编译添加调试map
sass --watch input.scss:output.css --sourcemap

//选择编译格式并添加调试map
sass --watch input.scss:output.css --style expanded --sourcemap

//开启debug信息
sass --watch input.scss:output.css --debug-info

  • --style表示解析后的css是什么排版格式;
    sass内置有四种编译格式:nestedexpandedcompact``compressed。
  • --sourcemap表示开启sourcemap调试。开启sourcemap调试后,会生成一个后缀名为.css.map文件。

四种编译排版演示

 //未编译样式
.box {
 width: 300px;
 height: 400px;
 &-title {
  height: 30px;
  line-height: 30px;
   }
 }
  • nested 编译排版格式

        /*命令行内容*/
     sass style.scss:style.css --style nested
    
     /*编译过后样式*/
      .box {
      width: 300px;
      height: 400px; }
     .box-title {
      height: 30px;
     line-height: 30px; }
    
  • expanded 编译排版格式

        /*命令行内容*/
    sass style.scss:style.css --style expanded
    
     /*编译过后样式*/
    .box {
      width: 300px;
      height: 400px;
         }
     .box-title {
       height: 30px;
       line-height: 30px;
         }
    
  • compact 编译排版格式

         /*命令行内容*/
         sass style.scss:style.css --style compact
    
        /*编译过后样式*/
       .box { width: 300px; height: 400px; }
       .box-title { height: 30px; line-height: 30px; }
    
  • compressed 编译排版格式

          /*命令行内容*/
          sass style.scss:style.css --style compressed
    
         /*编译过后样式*/
        .box{width:300px;height:400px}.box-title{height:30px;line-height:30px}

相关文章

  • 入门Sass——编译

    命令行编译 //单文件转换命令sass input.scss output.css //单文件监听命令sass -...

  • CSS 预处理器-Sass基础

    上一节讲完了Sass安装与编译的入门支持,本节主要讲Sass的基础语法。 1.变量 在Sass中可以定义变量,变量...

  • sass使用

    sass编译和介绍 安装vscode插件Live Sass Compiler编译sass 开启watch sass...

  • 安装-编译

    安装 安装node-sass来编译sass文件 安装ruby来编译sass文件 编译 node-sass 使用we...

  • gulp常用插件整理(持续更新)

    gulp常用插件整理 1.gulp-sass(sass编译) 2.gulp-compass(sass编译) 3.g...

  • gulp常用插件整理

    gulp常用插件整理 1.gulp-sass(sass编译) 2.gulp-compass(sass编译) 3.g...

  • webpack编译sass

    参考 webpack loaderssass 编译Sass webpack编译sass需要使用到的loader: ...

  • sass入门学习总结

    总论 sass 经cass编译器编译成css。sass 兼容了css语法。sass 带有变量,mixin,循环,简...

  • 前端自动化-sass篇

    1、Grunt 配置 Sass 编译的示例代码 2、Gulp 配置 Sass 编译的示例代码

  • Hbuilder scss/sass编译 插件

    1. 安装插件 工具 -> 插件安装 -> scss/sass编译 -> 安装安装 scss/sass编译 插件 ...

网友评论

      本文标题:入门Sass——编译

      本文链接:https://www.haomeiwen.com/subject/zvzyjxtx.html