Skip to content

Commit e2f4f94

Browse files
author
pemrouz
committed
more contained: input/output expects resource
1 parent 30207cf commit e2f4f94

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Ripple | Export
2+
[![Coverage Status](https://coveralls.io/repos/rijs/export/badge.svg?branch=master&service=github)](https://coveralls.io/github/rijs/export?branch=master)
3+
[![Build Status](https://travis-ci.org/rijs/export.svg)](https://travis-ci.org/rijs/export)
4+
5+
Combines all resources under the resources directory into a single `index.js` file. This is so you can export and import a bundle of resources from separate repos by simplying `require`ing them. Note that this is not the same bundling, since function resources are linked with requires, such that you could subsequently browserify the output (`index.js`) to produce a client bundle.
6+
7+
```js
8+
import buttons from 'ux-button'
9+
import inputs from 'ux-input'
10+
import rijs from 'rijs'
11+
12+
ripple = rijs({ .. })
13+
.resource(buttons)
14+
.resource(inputs)
15+
```
16+
17+
Running `rijs.export` (defaults to `rijs.export dist/resources`), likely as part of a [`npm run build`](https://github.com/vanillacomponents/ux-input/blob/master/package.json#L12) would place the `index.js` file under `dist/resources/index.js`. You then just need to [point the `main`](https://github.com/vanillacomponents/ux-input/blob/master/package.json#L4) field in your `package.json` to point this file so it can be required.

export

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ var write = require('fs').writeFileSync
88
, glob = require('glob').sync
99
, utilise = require('utilise')
1010

11-
var dir = process.cwd()
12-
, root = resolve(dir, process.argv[2] || '')
13-
, resources = str(glob(dir+'/dist/**/!(test).{js,css}')
11+
var root = resolve(process.cwd(), process.argv[2] || 'dist/resources')
12+
, resources = str(glob(root+'/**/!(test|index).{js,css}')
1413
.map(resource))
1514
.replace(/"require\((.*?)\)"/g, 'require($1)')
1615
.replace(/({"name")/g, '\n$1')

0 commit comments

Comments
 (0)