ml

macro-loader

Macro Preprocessor for webpack

Showing:

Popularity

Downloads/wk

0

Maintenance

No Maintenance Data Available

Package

Dependencies

3

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Macro Loader

A C-style macro pre-processor for webpack

Install

$ npm i macro-loader --save-dev

Usage

In the service layer files, you can easily use C-style macro like following:

// ChoiceItem.jsx
#ifdef REACT_NATIVE
import React, { Component, PropTypes } from 'react-native'
#else
import React, { Component, PropTypes } from 'react'
#endif

class ChoiceItem extends Component {
}
...

In the configuration for webpack, add this module to preloaders or loaders:

...
preLoaders: [
  {
    test: /\.(js|jsx)$/,
    include: srcPath,
    loader: 'eslint-loader!macro-loader?config=' + path.join(__dirname,'macros.json')
  }
]
...

And add a configuration json file:

//macros.json
[]
// or ["REACT_NATIVE"] for react-native proj conf

LICENCE

MIT

TODO

The module is still in dev and looking forward for more features

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial