假设有这样的目录结构
── view
├── a
│ └── a.php
└── b.php
Gruntfile.js:
module.exports = function(grunt) {
grunt.initConfig({
replace: {
files: {
replacements: [{
from: '.js',
to: '.js?v=1'
}],
expand: true,
cwd: 'view/',
src: ['**/*.php', '*.php'],
dest: 'dist/'
}
}
});
grunt.loadNpmTasks('grunt-text-replace');
grunt.registerTask('default', ['replace']);
};
然后我得到这样的目录
── dist
├── a.php
└── b.php
请问是我哪里写错了吗?
貌似这个插件不支持这样做,换了 grunt-replace 以后可以了