Skip to content

Commit

Permalink
build: migrate to rollup-plugin-copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernest committed Mar 26, 2024
1 parent 3cb79cb commit 75091ef
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 82 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"prettier": "^2.0.5",
"rimraf": "^5.0.0",
"rollup": "^3.0.0",
"rollup-plugin-copy-watch": "^0.0.1",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-svg": "^2.0.0",
"rollup-plugin-typescript2": "^0.34.0",
Expand Down
126 changes: 48 additions & 78 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const terser = require('@rollup/plugin-terser')
const resolve = require('@rollup/plugin-node-resolve').default
const globals = require('rollup-plugin-node-globals')
const vue = require('rollup-plugin-vue')
const copy = require('rollup-plugin-copy-watch')
const copy = require('rollup-plugin-copy')
const csso = require('csso')
const svg = require('rollup-plugin-svg')
const json = require('@rollup/plugin-json')
Expand Down Expand Up @@ -70,15 +70,14 @@ formats.forEach(format => {
const isWatchMode = process.env.npm_lifecycle_script.includes('--watch')
configs[configs.length - 1].plugins.push(
copy({
watch: isWatchMode ? ['src/index.css'] : false,
copyOnce: isWatchMode === false,
verbose: true,
targets: [
{
src: 'src/index.css',
dest: 'dist',
rename: (name, extension) => `${name}.min.${extension}`,
transform: content => csso.minify(content).css,
transform: content => csso.minify(content.toString()).css,
},
{ src: 'src/index.css', dest: 'dist' },
],
Expand Down

0 comments on commit 75091ef

Please sign in to comment.