目标:
我正在尝试为客户端模板开发构建一个轻松的工作流程。
文档根:
/views/uncompiled/
/static/js/compiled/
我们从/views/uncompiled/
这是我可以构建东西的地方,/views/uncompiled/index.html
例如。
我正在构建dust.js模板,所以我也在使用dusterjs来监听我的目录中的变化/views/uncompiled/
,并自动在我的目录中呈现已编译*.js
的对应项/static/js/compiled/
。
因此,只要保存更改就会/views/uncompiled/index.html
呈现出来。/static/js/compiled/index.js
问题:
我layout.html
的越来越大了。*.js
每次添加另一个模板时,我都需要包含一个新脚本:
<head>
<script src='/static/js/compiled/index.js'></script>
<script src='/static/js/compiled/header.js'></script>
<script src='/static/js/compiled/footer.js'></script>
<script src='/static/js/compiled/baconstrips.js'></script>
...
</head>
解决方案:
在文件夹上使用另一个手表/static/js/compiled/
也会自动连接*.js
成一个单曲app.js
,只要该文件夹的内容发生变化,它就会始终包含在我<head>
的文件夹中:
<head>
<script src='/static/js/app.js'></script>
</head>
问题:
我想使用像Uglify.js这样也可以进行压缩的连接工具。
- 是否有任何节点包可以自动化上述解决方案?
- 是否有Uglify.js的本机功能已经做到了这一点?