我正在使用Bower和GruntJS。我认为grunt-bowercopy会在完成后删除bower_components
文件夹,但这种情况没有发生。Can GruntJS可以在复制文件后移除bower_components文件夹吗?
grunt-bowercopy可以在将文件复制到我想要的位置后删除bower_components文件夹吗?
这里是我的文件夹设置:
->Project
->Themes
->Theme
->assets
->scripts
->styles
->tools
->build
->bower_components
->bower.json
->gruntfile.js
->package.json
这里是我如何运行咕噜-bowercopy在我gruntfile.js
module.exports = function (grunt) {
// Loads the necessary tasks for this Grunt file.
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bowercopy: {
options: {
clear: true
},
js: {
options: {
destPrefix: '../../Themes/Theme/assets/'
},
//The key is the destination file. The value is the file from the bower_components folder
//The files will be added to a scripts folder at the location: ../../themes/3MTheme/assets/scripts
//The key is the name of the folder that is copied into the /assets folder.
src : 'scripts'
},
css: {
options: {
destPrefix: '../../Themes/Theme/assets/'
},
src: 'styles'
}
}
// Custom task, executed via the command "grunt bowercopy"
grunt.registerTask('bower', ['bowercopy']);
};
如果在构建项目后删除bower_components文件夹,则需要再次为下一个版本安装这些组件,对吧?你为什么要删除该文件夹?它仅用于开发目的,不会进入dist文件夹。 –
@Sergey,我正在从共享服务器复制一些文件。这些文件可能会偶尔被其他人更新,我想确保我将这些最新的更新拉下来。 – Mdd