Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

gisikw/xml-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Webpack XML loader

A Webpack plugin for loading XML files.

Installation

Install via npm:

npm install --save xml-loader

Usage

You can require XML data like this:

var data = require('xml!./data.xml');
// => returns data.xml content as json-parsed object

var data = require('xml?explicitChildren=true!./data.xml');
// => returns data.xml content as json-parsed object and put child elements to separate properties

The loader will translate the data.xml file into a JSON Object. node-xml2js processors are supported via query syntax.

Usage with webpack.config

To require XML files like this: require('data.xml') , you can add the xml-loader to your webpack config:

module : {
  loaders : [
    { test: /\.xml$/, loader: 'xml-loader' } // will load all .xml files with xml-loader by default
  ]
}

Credits

About

A webpack module to load XML files.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •