是否可以在.pug模板中包含/嵌入SCSS,以便一旦使用WebPack构建后,它就可以成为HTML模板中的嵌入式CSS?
这里是一个例子:
我具有以下项目结构:
src/
..components/
....header/
......header1.pug
......header1.scss
..navcustom-template.pug
..customfooter-template.pug
..non-template-specific.scss
我想编译一下:
/src/navcustom-template.pug
// Section: NavCustom
//Included SCSS
style
include header.scss
//or/and embedded SCSS
style.
//Embedded SCSS here
script.
// template specific JS here
header
div.col-md-4
// Social Media Code
div.col-md-4
// Logo Code
div.col-md-4
// Call to Action Code
nav
// Nav stuff here
,使其类似于以下内容:
/dist/navcustom-template.html
<!--
Section: NavCustom
-->
<style>
//Template Specific CSS Embedded Here
</style>
<script type="text/javascript">
//Template Specific JS Imports Here
</script>
<header>
<div class="col-md-4">
// Social Media Code
</div>
<div class="col-md-4">
// Logo Code
</div>
<div class="col-md-4">
// Call to Action Code
</div>
</header>
<nav>
</nav>
如果您想获得更多背景信息,这是为了简化具有独特处理方式的第三方电子商务平台的开发。