亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 purgecss safelist 選項給出 UnhandledPromise

使用 purgecss safelist 選項給出 UnhandledPromise

慕桂英4014372 2023-10-14 19:10:22
我正在使用 purgecss 從我的項目中刪除不必要的 css。purgecss --css static/css/*.chunk.css --content index.html static/js/*.chunk.js --output static/css/但不幸的是,它還刪除了我需要的一些 css 類,因此參考我嘗試使用安全列表選項來進行一些例外的文檔purgecss --safelist [modal] --css static/css/*.chunk.css --content index.html static/js/*.chunk.js --output static/css/它給出了以此結尾的長錯誤at U.evaluateRule (/usr/local/lib/node_modules/purgecss/lib/purgecss.js:1:6585)at /usr/local/lib/node_modules/purgecss/lib/purgecss.js:1:9659(node:10023) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 593)
查看完整描述

1 回答

?
呼如林

TA貢獻1798條經驗 獲得超3個贊

使用替代方法(即使用配置文件)使其正常工作purgecss.config.js。


module.exports = {

  content: ['build/index.html', 'build/static/js/*.chunk.js'],

  css: ['build/static/css/*.chunk.css'],

  output: 'build/static/css/',

  safelist: [/^modal-/]

}

在package.json文件中


"scripts": {

     "postbuild": "purgecss --config ./purgecss.config.js",

     .....other scripts

 },


查看完整回答
反對 回復 2023-10-14
  • 1 回答
  • 0 關注
  • 109 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號