MorJS copy - 文件拷貝

2023-11-07 16:12 更新
  • 類(lèi)型: ?(string | { from: string, to: string })[]?
  • 默認(rèn)值: ?[]?

設(shè)置要復(fù)制到輸出目錄的文件或文件夾,該配置受 ?ignore? 配置 影響

默認(rèn)情況下,MorJS 會(huì)自動(dòng)拷貝如下后綴的文件:

# 以下資源文件會(huì)在編譯過(guò)程中自動(dòng)拷貝
.jpg
.jpeg
.png
.svg
.bmp
.ico
.gif
.webp
.otf
.ttf
.woff
.woff2
.eot
.cer
.ogg
.aac
.mp4
.wav
.mp3
.m4a
.silk
.wasm
.br
.cert

當(dāng)配置為字符串時(shí),默認(rèn)拷貝到產(chǎn)物目錄,如:

{
copy: ['foo.json', 'src/bar.json']
}

會(huì)產(chǎn)生如下產(chǎn)物的目錄結(jié)構(gòu):

+ dist
- bar.json
- foo.json
+ src
- bar.json
- foo.json

當(dāng)通過(guò)對(duì)象配置具體的拷貝位置,其中 ?from? 相對(duì)路徑的起點(diǎn)為項(xiàng)目根目錄,目標(biāo) ?to? 相對(duì)路徑的起點(diǎn)為 ?outputPath? 配置所指向的目錄:

{
copy: [
{ from: 'from', to: 'somewhere/insideOutputPath' },
{ from: 'anotherFile.json', to: './' }
]
}

這種情況下將產(chǎn)生如下產(chǎn)物目錄結(jié)構(gòu):

+ dist
+ somewhere
+ insideOutputPath
- onefile.json
- anotherFile.json
+ from
- onefile.json
- anotherFile.json


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)