babel-plugin-react-native-platform-specific-extensions

1.1.1 • Public • Published

babel-plugin-react-native-platform-specific-extensions

NPM version Build Status Coverage Status PRs Welcome Greenkeeper badge

Allow react-native platform specific extensions to be used for other file types than Javascript.

Example:

import styles from "./styles.css";

  • styles.android.css <- Android only
  • styles.ios.css <- iOS only
  • styles.native.css <- Both Android and iOS
  • styles.css <- Default. Android, iOS and Web

Usage

Step 1: Install

yarn add --dev babel-plugin-react-native-platform-specific-extensions

or

npm install --save-dev babel-plugin-react-native-platform-specific-extensions

Step 2: Configure .babelrc

You must give one or more file extensions inside an array in the plugin options.

{
  "presets": [
    "react-native"
  ],
  "plugins": [
    ["react-native-platform-specific-extensions", {
      "extensions": ["css", "scss", "sass"],
    }]
  ]
}

TODO

  • Support require.

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-react-native-platform-specific-extensions

Weekly Downloads

4,505

Version

1.1.1

License

MIT

Unpacked Size

8.78 kB

Total Files

5

Last publish

Collaborators

  • kristerkari