Skip to content

Commit 72b27b5

Browse files
author
mcha
committed
refactor(index.js,-readme,-packagejson): require both placeholder and include options
BREAKING CHANGE: both include and placeholder config options are required
1 parent 2f19783 commit 72b27b5

9 files changed

Lines changed: 1410 additions & 16 deletions

File tree

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,33 @@ export default {
99
dir: 'dist',
1010
},
1111
plugins: [
12-
litTw({ include: 'src/components/**/*.ts' }),
12+
litTw({
13+
include: 'src/components/**/*.ts',
14+
placeholder: 'tw_placeholder',
15+
}),
1316
],
14-
}
17+
};
1518
```
1619

20+
lit component
21+
22+
```ts
23+
import { html, css, LitElement } from 'lit';
24+
import { customElement } from 'lit/decorators.js';
25+
26+
@customElement('simple-component')
27+
export class SimpleComponent extends LitElement {
28+
static styles = css`tw_placeholder`;
29+
30+
render() {
31+
return html`<h1 class="text-purple-400 hover_text-green-500">Hello, world!</h1>`;
32+
}
33+
}
34+
```
1735

1836
## Todos
19-
- is this performant?
20-
- tw seperator slash read tailwind config, styles.css?
21-
- ...
37+
38+
- is this performant???
39+
- tailwind separator (`_` to default one `:`)
40+
- read tailwind config, styles.css?
41+
- ...

helpers/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// https://github.com/rollup/plugins/blob/master/util/test.js
2+
const getCode = async (bundle, outputOptions, allFiles = false) => {
3+
const { output } = await bundle.generate(
4+
outputOptions || { format: 'iife' },
5+
);
6+
if (allFiles) {
7+
return output.map(({ code, fileName, source, map }) => {
8+
return { code, fileName, source, map };
9+
});
10+
}
11+
const [{ code }] = output;
12+
return code;
13+
};
14+
15+
module.exports = {
16+
getCode,
17+
};

0 commit comments

Comments
 (0)