Skip to content

Commit

Permalink
refactor(index.js,-readme,-packagejson): require both placeholder and…
Browse files Browse the repository at this point in the history
… include options

BREAKING CHANGE: both include and placeholder config options are required
  • Loading branch information
mcha committed Jun 9, 2021
1 parent 2f19783 commit 72b27b5
Show file tree
Hide file tree
Showing 9 changed files with 1,410 additions and 16 deletions.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,33 @@ export default {
dir: 'dist',
},
plugins: [
litTw({ include: 'src/components/**/*.ts' }),
litTw({
include: 'src/components/**/*.ts',
placeholder: 'tw_placeholder',
}),
],
}
};
```

lit component

```ts
import { html, css, LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';

@customElement('simple-component')
export class SimpleComponent extends LitElement {
static styles = css`tw_placeholder`;

render() {
return html`<h1 class="text-purple-400 hover_text-green-500">Hello, world!</h1>`;
}
}
```

## Todos
- is this performant?
- tw seperator slash read tailwind config, styles.css?
- ...

- is this performant???
- tailwind separator (`_` to default one `:`)
- read tailwind config, styles.css?
- ...
17 changes: 17 additions & 0 deletions helpers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// https://github.com/rollup/plugins/blob/master/util/test.js
const getCode = async (bundle, outputOptions, allFiles = false) => {
const { output } = await bundle.generate(
outputOptions || { format: 'iife' },
);
if (allFiles) {
return output.map(({ code, fileName, source, map }) => {
return { code, fileName, source, map };
});
}
const [{ code }] = output;
return code;
};

module.exports = {
getCode,
};
Loading

0 comments on commit 72b27b5

Please sign in to comment.