tmx-loader
v4.3.0
Published
A webpack module to load tmx tiled map (e.g. .tmx) files.
Downloads
7
Maintainers
Readme
Webpack tmx loader
A Webpack plugin for loading tmx files (for example .tmx).
Installation
Install via npm:
npm install --save tmx-loader
Usage
You can require tmx map like this:
var data = require('tmx!./map.tmx');
// => returns map.tmx content as json parsed object
The loader will translate the map.tmx
file into a JSON Object.
Usage with webpack.config
To require tmx files like this: require('map.tmx')
, you can add the tmx-loader to your webpack config:
module : {
loaders : [
{ test: /\.tmx?$/, loader: 'tmx-loader' } //will load all .tmx files with tmx-loader by default
]
}
Options
tilepath
Tells the loader which tilemap is used to display the data. Default: ''
Examples:
var data = require('tmx?tilepath=./tilemap.tsx!./map.tmx'); //load tilemap
Credits
- TMX parsing done with node-tmx-parser by Andrew Kelley