Loops make Less to run out of memory. (Structure optimization)

独自空忆成欢 提交于 2019-12-02 06:40:17

A partial answer, there's way to get rid of loops: color and icon data can be defined as mixins calls, here's mini example:

.colors() {
    // "array" of colors
    .-(Maroon, #800000);
    .-(Red,    #FF0000);
    .-(Orange, #FFA500);
    .-(Yellow, #FFFF00);
}

// generate color classes:

.some-prefix {
    .colors();
    .-(@name, @color) {
        &.@{name} {
            color: contrast(@color);
            background: @color;
            // etc.
        }
    }
}

Same for icons...

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!