![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
tinyjs-resource-loader
Advanced tools
GitHub: https://github.com/ant-tinyjs/tinyjs-resource-loader
用于处理 tinyjs 中 tileset 游戏资源的 webpack loader
npm install tinyjs-resource-loader -D
.tileset
(或任意名称)配置文件animation
├── .tileset
├── 001.png
├── 002.png
└── 003.png
yaml
格式对 .tileset
进行配置skip: 1
colors: 16
scale: 0.5
webpack.config.js
中配置 tinyjs-resource-loader
,该 loader 应作用于上面的配置文件{
test: /\.tileset$/,
use: [
{
loader: 'tinyjs-resource-loader',
options: {
process: true,
output: './output',
name: '[name]_[hash:6].[ext]',
limit: false,
outputPath: 'res'
// image: {
// outputPath: 'res',
// publicPath: './'
// },
// json: {
// outputPath: 'res',
// publicPath: './res'
// }
// loader: 'json',
}
}
]
}
.tileset
文件import tilesetAnimationJSON from './frames/animation/.tileset';
.tileset
同目录的图片合成标准 tileset PNG 和 JSON 文件colors
指定的颜色值进行压缩example/output
目录(由配置参数 options.output
指定)example/output
中的 JSON[可选] 和图片构建到 dist
中(由 webpack config 中的 output.path
指定)。example
├── resources
│ ├── animation # 这里是动画帧存放的目录
│ │ ├── .tileset
│ │ ├── 001.png
│ │ ├── 002.png
│ │ └── 003.png
│ └── index.js
├── output # 图片处理后的 JSON 和图片存放目录
│ ├── tileset-animation.json
│ └── tileset-animation.png
├── dist # 最终产物
│ └── res
│ ├── tileset-animation_[hash].json
│ └── tileset-animation_[hash].png
在使用 tinyjs-resource-loader 处理 tinyjs 项目中的 JSON 和 png 之前,首先应确保系统中安装了以下工具:
identify
命令(主要用于获取一个或多个图像文件的格式和特性)pngquant
命令注:如环境限制不能安装,请看以下的
options.process
配置解释
options.output
: 图片处理后输出 JSON 和图片文件的目录,一般选择源码中的目录,建议提交远程仓库。设置为空时,则不会在源码目录中输出。options.loader
: 指定 JSON 文件最终产物是文件还是js对象,或者完全不处理,默认为 url
可选 json
options.process
:是否强制进行图片处理,false
时直接从目录中读取先前构建好的文件options.outputPath
:即 file-loader outputPath 配置options.publicPath
:即 file-loader outputPath publicPath 配置options.image
:图片文件的 url-loader 参数options.json
:JSON 文件的 url-loader 参数。options.loader
为 json
时无效options.resource
: 按照配置的模板对 JSON 文件中的 json 和图片路径进行替换。仅在 options.loader
为 json
时有效options.verbose
: 是否展示完整错误日志
outputPath
和publicPath
在options.image/json
中配置时,优先级高于options
中的options.process
设置为false
时,会跳过图片处理过程中的前 4 步,直接从options.output
配置的目录中读取 JSON 和图片,并通过 url-loader 将它们构建到指定目录中,但会产生 webpack warning。这是为了确保项目在本地构建过一次以后,在远程机器(很可能没有安装 ImageMagick 或 pngquant 系统依赖)也能够进行构建,兼顾跨平台云构建的需求
trim
:移除图片周围的空白,参照 spritesheet.js,默认 false
scale
: 图片缩放比例,基于 imagemagick-stream 对图片进行缩放,默认 1
padding
: 雪碧图中图片的间隙,参照 spritesheet.js,默认 10
skip
:抽帧时跳过的帧数,如果指定为 N,会每跳过 N 帧保留一帧,默认 0
colors
:雪碧图进行图片压缩的颜色数,默认 256
files
: 以 [path]-[name]
对象格式配置的文件路径,如果配置了 files
,将不会从 .tileset
所在目录读取动画帧,而且从 files
指定的路径中读取excludes
: 合成时排除的图片路径interpolate
: $name$-fallback
形式的字符串(可不包含 $name$
),用于修改名称rotatable
: 图片合成雪碧图时是否可旋转files
配置的路径为相对于 .tileset
所在目录的路径,示例:
files:
../animation-a/001.png: animation-a
../animation-b/001.png: animation-b
../animation-c/001.png: animation-c
FAQs
用于处理 tiny.js 游戏资源的 webpack loader
The npm package tinyjs-resource-loader receives a total of 6 weekly downloads. As such, tinyjs-resource-loader popularity was classified as not popular.
We found that tinyjs-resource-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.