gulp-useref生成的文件能不能在后面加上版本号?


假如html结构像下面这样:


 <html>
<head>
    <!-- build:css css/combined.css -->
    <link href="css/one.css" rel="stylesheet">
    <link href="css/two.css" rel="stylesheet">
    <!-- endbuild -->
</head>
<body>
    <!-- build:js scripts/combined.js -->
    <script type="text/javascript" src="scripts/one.js"></script>
    <script type="text/javascript" src="scripts/two.js"></script>
    <!-- endbuild -->
</body>
</html>

然后,build之后,我想要其加上版本号,应该怎么做?现在build之后是不带后面的 ?v=20150829


 <html>
<head>
    <link rel="stylesheet" href="css/combined.css?v=20150829"/>
</head>
<body>
    <script src="scripts/combined.js?v=20150829"></script>
</body>
</html>

哪个gulp的插件可以做到?

web前端开发 gulp-useref JavaScript gulp gulp-inject

仲夏夜D梦♂ 9 years, 10 months ago

推荐 gulp-rev-append插件 当然你可以上 http://gulpjs.com/plugins/  去搜看适合你的插件

JK_TAM answered 9 years, 10 months ago

Your Answer