2

我有以下结构(我正在使用 Django)。

app
|__ templates
  |__ index.html
|__ static
  |__ js
    |__ main.js

我需要做的是:

  1. 丑化/缩小main.jsmain.min.js
  2. 文件转main.min.js成类似main.min.12345678.js
  3. 确保index.html有新main.min.12345678.js文件

我的index.html样子:

// ....
<script src="{% static "js/main.js" %}"</script>
</body>
</html>

我正在尝试 Grunt filerev (https://github.com/yeoman/grunt-filerev)并且我能够正确运行它,但是如何main.js用版本化的替换它main.js

我尝试使用 grunt usemin,但是有没有一种方法可以让我不必创建新index.html文件?

4

1 回答 1

0

您是否尝试使用grunt-filerev-replace

我出于完全相同的原因成功地使用它。

于 2014-10-16T15:33:17.477 回答