Skip to content

Commit 773557b

Browse files
committed
Initial commit.
0 parents  commit 773557b

15 files changed

+10896
-0
lines changed

.github/workflows/publish.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish Package to npmjs.
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
# Setup .npmrc file to publish to npm
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: '16.x'
16+
registry-url: 'https://registry.npmjs.org'
17+
- run: npm ci
18+
- run: npm run build
19+
- run: npm publish
20+
env:
21+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/run-tests.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [14.x, 16.x, 18.x]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
- run: npm ci
24+
- run: npm run build
25+
- run: npm run test

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.idea/
2+
.parcel-cache/
3+
dist/
4+
node_modules/
5+
tests/.parcel-cache/
6+
tests/dist/
7+
tests/dist-optimized/
8+
tests/node_modules/

.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea/
2+
.parcel-cache/
3+
src/
4+
node_modules/
5+
tests/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Anteris
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Minifies HTML literals that Terser ignores.
2+
3+
# About
4+
This plugin takes template literals (such as Lit's) and minifies them. This helps ensure that using such literals does not increase the package size when using Parcel. For example:
5+
6+
```ts
7+
import { css } from 'lit';
8+
9+
css`
10+
div {
11+
padding:20px;
12+
}
13+
14+
h1 {
15+
padding:5px;
16+
color:purple;
17+
}
18+
`;
19+
```
20+
21+
Would become:
22+
23+
```ts
24+
css`div{padding:20px}h1{padding:5px;color:purple}`;
25+
```
26+
27+
**Note:** When the `--no-optimize` flag is passed to Parcel, your literals _will not_ be minified.
28+
29+
# Install
30+
31+
To install this transformer, add the following lines to your [`.parcelrc`](https://parceljs.org/features/plugins/#.parcelrc) file:
32+
33+
```json
34+
{
35+
"extends": "@parcel/config-default",
36+
"transformers": {
37+
"*.{js,mjs,jsm,jsx,es6,cjs,ts,tsx}": [
38+
"@anteris/parcel-transformer-html-literals",
39+
"@parcel/transformer-babel",
40+
"@parcel/transformer-js",
41+
"@parcel/transformer-react-refresh-wrap"
42+
],
43+
}
44+
}
45+
```
46+
47+
**Note:* It is important that `@anteris/parcel-transformer-html-literals` be the first transformer in the list.

0 commit comments

Comments
 (0)