Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Osteoporosis/php-vitelinker
php-vitelinker: A CLI tool for JS bundling. It provides includable php files after vite build.
https://github.com/Osteoporosis/php-vitelinker
build build-tool bundler include javascript minifier packer php tree-shaking typescript vite
Last synced: 14 days ago
JSON representation
php-vitelinker: A CLI tool for JS bundling. It provides includable php files after vite build.
- Host: GitHub
- URL: https://github.com/Osteoporosis/php-vitelinker
- Owner: Osteoporosis
- License: mit
- Created: 2024-07-19T05:51:01.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-10-14T20:16:06.000Z (3 months ago)
- Last Synced: 2024-12-15T05:15:39.872Z (29 days ago)
- Topics: build, build-tool, bundler, include, javascript, minifier, packer, php, tree-shaking, typescript, vite
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/php-vitelinker
- Size: 244 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-vite - php-vitelinker - A CLI tool that generates includable PHP files after building bundles. (Integrations with Backends / PHP)
- trackawesomelist - php-vitelinker (⭐0) - A CLI tool that generates includable PHP files after building bundles. (Recently Updated / [Sep 04, 2024](/content/2024/09/04/README.md))
- fucking-awesome-vite - php-vitelinker - A CLI tool that generates includable PHP files after building bundles. (Integrations with Backends / PHP)
README
# php-vitelinker
A CLI tool for JS bundling. This tool generates includable PHP files after a Vite build, simplifying the integration of your JS assets into PHP projects.
## Installation
To get started, install php-vitelinker as a development dependency:
> `$ npm install -D php-vitelinker`
## Usage
Run php-vitelinker with your entry points, specifying the optional prefix and distribution paths as needed:
> `$ npx php-vitelinker <.ts/.tsx/.js/.jsxFileOrGlobPatternEntryPoints...> [--prefix ] --dist `
### What is `--prefix `?
The `--prefix` option allows you to set a server-side prefix path for the assets. This is useful when you need specific absolute or relative paths for your included assets. The default value is `./`.
## Example
To reproduce the `/dist` directory under `example_project`, you can use the following command:
> `$ npm run build:example_project`
This command is equivalent to:
> `"build:example_project": "tsc && node ./dist/main.js ../example_project/react-app/src/main.tsx \"../example_project/hello_world_scripts/**/*(*.ts*|*.js*)\" --dist ../example_project/dist"`
### Quick link to the `example_project`
https://github.com/Osteoporosis/php-vitelinker/tree/main/example_project
## Output
After running php-vitelinker, you will get `packed__{entry_point_name}.php` files. These files tag the assets, making them ready to be included in your PHP codebase.
**Your feedback and contributions are welcome.**