我正在使用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