SASS编译空CSS文件?

时间:2012-08-18 13:04:39

标签: css sass

我正在尝试将这小块SCSS编译成CSS:

$font-size: 16px;
$em: $font-size / 1em;

$column: 48px;
$gutter: 24px;

 $cols1: ( 1 * ($column + $gutter) - $gutter) / $em;
 $cols2: ( 2 * ($column + $gutter) - $gutter) / $em;
 $cols3: ( 3 * ($column + $gutter) - $gutter) / $em;
 $cols4: ( 4 * ($column + $gutter) - $gutter) / $em;
 $cols5: ( 5 * ($column + $gutter) - $gutter) / $em;
 $cols6: ( 6 * ($column + $gutter) - $gutter) / $em;
 $cols7: ( 7 * ($column + $gutter) - $gutter) / $em;
 $cols8: ( 8 * ($column + $gutter) - $gutter) / $em;
 $cols9: ( 9 * ($column + $gutter) - $gutter) / $em;
$cols10: (10 * ($column + $gutter) - $gutter) / $em;
$cols11: (11 * ($column + $gutter) - $gutter) / $em;
$cols12: (12 * ($column + $gutter) - $gutter) / $em;
$cols13: (13 * ($column + $gutter) - $gutter) / $em;
$cols14: (14 * ($column + $gutter) - $gutter) / $em;
$cols15: (15 * ($column + $gutter) - $gutter) / $em;
$cols16: (16 * ($column + $gutter) - $gutter) / $em;

同时使用sass grid.scss grid.csssass --watch grid.scss:grid.css进行了尝试 - 我得到的只是一个空白的css文件。这是怎么回事?

1 个答案:

答案 0 :(得分:8)

如@pjumble评论所述,您只是定义变量。获取代码并添加其他hello_world语句:

$font-size: 16px;
$em: $font-size / 1em;

$column: 48px;
$gutter: 24px;

 $cols1: ( 1 * ($column + $gutter) - $gutter) / $em;
 $cols2: ( 2 * ($column + $gutter) - $gutter) / $em;
 $cols3: ( 3 * ($column + $gutter) - $gutter) / $em;
 $cols4: ( 4 * ($column + $gutter) - $gutter) / $em;
 $cols5: ( 5 * ($column + $gutter) - $gutter) / $em;
 $cols6: ( 6 * ($column + $gutter) - $gutter) / $em;
 $cols7: ( 7 * ($column + $gutter) - $gutter) / $em;
 $cols8: ( 8 * ($column + $gutter) - $gutter) / $em;
 $cols9: ( 9 * ($column + $gutter) - $gutter) / $em;
$cols10: (10 * ($column + $gutter) - $gutter) / $em;
$cols11: (11 * ($column + $gutter) - $gutter) / $em;
$cols12: (12 * ($column + $gutter) - $gutter) / $em;
$cols13: (13 * ($column + $gutter) - $gutter) / $em;
$cols14: (14 * ($column + $gutter) - $gutter) / $em;
$cols15: (15 * ($column + $gutter) - $gutter) / $em;
$cols16: (16 * ($column + $gutter) - $gutter) / $em;

.hello_world{ width: $column }

命令sass grid.scss grid.css产生:

.hello_world {
  width: 48px; }