首页 文章

聚合物1.1和SASS

提问于
浏览
2

由于某种原因,没有关于如何将sass和聚合物一起使用的信息 . 首先我尝试了以下内容:

<dom-module id="app-header">
    <link rel="import" type="css" href="../css/app-header.css">

    <template> 
        ...

这里样式表是外部的,我可以轻松地将我的scss转换为css .

虽然这有效,但样式将应用于整个文档 .

无论如何,在Polymer的1.1 release中这已被弃用,虽然有一种共享样式的方法,但您仍然可以在模板标签中使用css

<!-- shared-styles.html -->
<dom-module id="shared-styles">
    <template>
        <style>
            .warning {
                color: red;
                font-weight: bold;
            }
        </style>
    </template>
</dom-module>

使用scss与聚合物1.1的最佳方法是什么?

1 回答

  • 3

    在Polymer 1.1中,不推荐使用外部样式表来支持“样式模块” .

    My solution was to create a bash script,它获取scss转换器的输出并将其包装在自定义样式模块定义中 .

    我将此脚本附加到PHPStorm文件观察器,我所要做的就是修改我的SCSS,所有内容都是自动生成的 .

相关问题