Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ridermansb/files.macro
Read files name from folder at build time and use as regular array of strings
https://github.com/ridermansb/files.macro
babel-macros hacktoberfest macro
Last synced: 3 months ago
JSON representation
Read files name from folder at build time and use as regular array of strings
- Host: GitHub
- URL: https://github.com/ridermansb/files.macro
- Owner: Ridermansb
- Created: 2019-03-07T14:28:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-21T13:59:34.000Z (almost 4 years ago)
- Last Synced: 2024-07-19T11:37:46.383Z (4 months ago)
- Topics: babel-macros, hacktoberfest, macro
- Language: JavaScript
- Homepage:
- Size: 2.04 MB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# files.macro
![Travis (.org) branch](https://img.shields.io/travis/ridermansb/files.macro/master.svg?style=flat-square) ![npm](https://img.shields.io/npm/v/files.macro.svg?style=flat-square) [![Babel Macro](https://img.shields.io/badge/babel--macro-%F0%9F%8E%A3-f5da55.svg?style=flat-square)](https://github.com/kentcdodds/babel-plugin-macros) [![Greenkeeper badge](https://badges.greenkeeper.io/ridermansb/files.macro.svg?style=flat-square)](https://greenkeeper.io/)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FRidermansb%2Ffiles.macro.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FRidermansb%2Ffiles.macro?ref=badge_shield)> Get array with file names in build time
## Usage
Just call function passing directory parameter:
```js
import files from "files.macro";const allImages = files("./assets/images");
// Will transpiled to
// ↓ ↓ ↓ ↓ ↓ ↓
const allImages = [ 'avatar.png', 'catalog.png' ]
```## License
MIT
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FRidermansb%2Ffiles.macro.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FRidermansb%2Ffiles.macro?ref=badge_large)