选择器中的输出触笔循环变量

时间:2018-10-10 16:10:44

标签: stylus

我正在尝试使用for循环来生成选择器和属性,但是它不起作用。这是我的代码:

colours = cola lychee lemonade tonic cherry ginger pineapple lemon lime elderflower cream-soda cream-soda-diet blackberry blueberry grape tropical raspberry 
cola = #1f2023
lychee = #9ca6b1
lemonade = #e0e5ed
tonic = #f8f9fa
cherry = #f7362b
ginger = #f79945
pineapple = #ffad00
lemon = #f5d600
lime = #6ecc54
elderflower = #4acccf
cream-soda = #00abff
cream-soda-diet = #F2FBFF
blackberry = #45388c
blueberry = #8f78e8
grape = #663da6
tropical = #cc78d1
raspberry = #fc007a
bubblegum = #f78cbf

button
    for colour in colours
        &.{colour}
            background colour

我希望它输出如下内容:

button.cola {
    background: #1f2023;
}
button.lychee {
    background: #9ca6b1
}
...

1 个答案:

答案 0 :(得分:0)

使用手写笔hashes是这里的解决方法。

    Vector3 initPosition //the position of the object that I want to move;
    private int whosTurn = 1;

    private IEnumerator WhoTurn()
    {
        if (whosTurn == 1)
        {
            GameController.MovePlayer(1);
            CameraController.isTurnPlayer1 = true;
            CameraController.isTurnPlayer2 = false;
            initPosition = positionPlayer1.transform.position;

        }
        else if (whosTurn == -1)
        {
            GameController.MovePlayer(2);
            CameraController.isTurnPlayer2 = true;
            CameraController.isTurnPlayer1 = false;
        }
        whosTurn = whosTurn * -1;
        yield return 0;

生成the output you're looking for