我尝试一个简单的使用,使 - grunt-include-source但是我没有成功 -咕噜,包括源不起作用
我Gruntfile是 -
module.exports = function (grunt) {
grunt.initConfig({
includeSource: {
options: {
basePath: 'app/file1.js'
},
myTarget: {
files: {
'dist/index.html': 'app/index.html'
}
}
}
});
grunt.loadNpmTasks('grunt-include-source');
grunt.registerTask('serve', function (target) {
grunt.task.run('includeSource');
});
}
中的index.html是 -
<html>
<head>
</head>
<body>
<!-- include: "type": "js", "files": "scripts/*.js" -->
</body>
</html>
我的文件夹层次是 -
Gruntfile.js
app >
file1.js
index.html
dist >
index.html
我跑grunt serve
并在dist>index.html
文件夹中得到的输出 -
<html>
<head>
</head>
<body>
</body>
</html>
没有预期 - <script src="scripts/file1.js"></script>
我一直遵循作为documentation并在此question,
为什么我不没有达到预期的产出?
你可以发布您的完整gruntfile –
这是整个文件 – URL87