https://github.com/cloakedninjas/phaser-import-pipeline
https://github.com/cloakedninjas/phaser-import-pipeline
phaser phaserjs
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/cloakedninjas/phaser-import-pipeline
- Owner: cloakedninjas
- Created: 2020-03-10T06:25:37.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T16:03:51.000Z (over 1 year ago)
- Last Synced: 2025-03-18T11:25:17.993Z (about 2 months ago)
- Topics: phaser, phaserjs
- Language: JavaScript
- Size: 665 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Phaser 3 Asset Import Pipeline
- Drop files into corresponding directories:
- source/image
- source/audio
- Have them copied to the output directory:
- assets/image
- assets/audio
- Normalize the filenames
- to lower case
- convert spaces, hyphens to underscores
- Record filesize of each asset into a
- manifest.json
- Append metadata into manifest
- spritesheet (frameWidth, frameHeight)## Installation
`npm i phaser-import-pipeline`
## Usage
Via CLI:
```
$ ./node_modules/.bin/phaser-import-pipeline
```Via npm script:
```json
{
"scripts": {
"import": "phaser-import-pipeline"
}
}
```- `no args` run copy process (cleanup filenames, add to manifest)
- `watch` watch directories, run base cmd## Config
Can be set using a `.pipelinerc` file. With sample contents:
```json
{
"sourceDir": "source",
"destDir": "assets",
"manifestPath": "assets/manifest.json",
"deleteOriginal": true
}
```## Asset types
`spritesheet` includes the following default manifest data
```json
{
"frameWidth": 0,
"frameHeight": 0
}
````audio` supports multiple file formats (the largest file will be used for manifest size calculation)
```json
{
"door_close": {
"file": ["door_close.mp3", "door_close.ogg"],
"size": 314500
}
}
```## Example output `manifest.json`
```json
{
"assetRoot": "assets",
"totalSize": 420615,
"assets": {
"image": {
"house": {
"file": "house.png",
"size": 2975
},
"person": {
"file": "person.jpg",
"size": 66520
}
},
"audio": {
"door_close": {
"file": "door_close.mp3",
"size": 314500
}
}
}
}
```