-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Featuring Glob, Excluding Files, and Change Output #16
Conversation
…solute start of glob instead use base, do test to react
Thanks for creating this PR!! I'm currently on a trip abroad, will watch it in the next few days!! |
I'm quite impressed with what you contributed, would there be some further description of those changes? Now I have a look, and see the usage has changed with your PR |
Thankyou for your support. Perhaps I would tell my use case, and some tricky way that implemented by these features. At the beginning, my use case is copying the root project with ignoring some folders. I thought it could be done by Vite by using this way: export default defineConfig({
build: {
rollupOptions: {
external: [/\.git/ig, /node_modules/ig],
},
},
publicDir: __dirname,
}); Unfortunately, the
DynamicPublicDirectory(["**"], {
ignore: [".git", "node_modules"],
})
import {PluginOption, defineConfig} from 'vite'
import DynamicPublicDirectory from "vite-multiple-assets";
export default defineConfig({
root: __dirname,
publicDir: false,
plugins: [
// this plugin must be put at last like after Vite or Svelte transformer
DynamicPublicDirectory([], {
ssr: false,
}) as PluginOption,
],
})
assets/fonts/google-mui/roboto/roboto-mono.sft
+ assets/fonts/{\x01,google-mui}/**
= google-mui/roboto/roboto-mono.sft DynamicPublicDirectory(["assets/fonts/{\x01,google-mui}/**"])
Caution It MUST return a POSIX filepath, Slash rather than backslash import path from "path/posix"; // NOTE: use posix for relative transformation
// different folder
DynamicPublicDirectory(["public/**"], {
dst: path.join(__dirname, ".cache"),
})
DynamicPublicDirectory(["public/**"], {
dst: ({ dstFile, filepath, }) => filepath.match(/.jpg$/ig) ? false : undefined,
}) let nonce = false;
DynamicPublicDirectory(["public/**"], {
dst: ({
opts: {__dst, ...opts}, __files, // muttable
dstFile, filepath, baseFile, // useful params to use
}) => {
if (!nonce) {
__files["new-no/existing/file.png"] = "/home/me/Pictures/image.png"
nonce = true;
}
}
})
export interface IConfigExtend extends Partial<Pick<Options, "ignore" | "dot">> {
dst?: string | FDst;
}
export interface IConfig extends
IConfigExtend,
Partial<Pick<Options, "onlyFiles" | "onlyDirectories" | "cwd" | "markDirectories">>
{
__dst?: string; // NOTE: internal destination from parsing rollup write bundlers nor vite config.
mimeTypes?: IMIME;
ssr?: boolean;
}
({
ignore: [],
onlyFiles: true,
onlyDirectories: false,
markDirectories: true,
dot: true,
absolute: false, // ENFORCED
})
import path from "path/posix"; // NOTE: use posix for relative transformation
export type IAssets = string[] | string | (IConfigExtend & { assets: string | string[]; })[];
DynamicPublicDirectory([
"public/**",
{
assets: "sample/**.txt",
ignore: "**photo**"
},
{
assets: ["assets/**", "vars/**"],
dot: true,
dst: path.join(__dirname, ".cache")
},
], {
dst: ({ dstFile, filepath, }) => filepath.match(/.jpg$/ig) ? false : undefined,
}) |
i tried running e2e for this PR!! It was successful, but there were too many changes from your PR. I need to look into it more closely |
I took a look, these are great, would there be more documentation about migrating from your old version to your new version on this site: https://github.com/nguyenbatranvan/vite-multiple-assets-doc |
Sure. I'll give the update in 3 weeks or more. |
tks so much!! |
There have been some changes to the source recently, I have rewritten it to add support for astro. |
Hi! Yeah. Sorry for long wait. I've been trying to update the docs. After that, I would try to match up my PR to latest change of this repo. |
thank you so much! I'm waiting for it |
maybe!! playwright not work with --stream run dev? |
Hi! I am not sure if it is the case. I just have not done with the cleaning yet. Thanks for let me know. Maybe, I would convert this PR to Draft to prevent Actions doing Test Checking for a moment. |
The documentation should be already done. I am not really doing full cleaning yet. This program still has issue in handling |
i see that the tests were successful, maybe merequest completion should be done, thanks for your contribution |
Seems I reverted this issue #20 when cleaning |
Ok, I already check other issues to make sure nothing important reverted. Thank you in advance, this plugin also help me for my current project. |
So far, everything is ready? |
Yes. It should be ready. |
tks so much!! Released |
Hi! Thankyou for this plugin. It really fully have all I need.
Currently, I have different issues I want to solve. My case is I want to copy whole root project to output dir withoyt
.git
, andnode_modules
. TheviteConfig.public
can retrieve public files only by single directory, and I thoughtviteConfig.build.rollupOptions.external
can be use to exclude thesenode_modules
and.git
from public listing. Unfortunately, I am wrong. So, I come to see this plugins and fully meet my objective.In this PR, I add some major features:
I've test this on examples React and Solid and works also when
dev
mode.But, this PR also has some issues or planned task:
./
because of auto translate without itstring[]
, it was planned to have more filters and individual output changing such aspackage.json
)