@localnerve/web-component-build 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +33 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  This library assembles a web component from its parts, allowing developers to author the component's parts in separate files. The parts are processed and written to an output directory. After processing, this library exposes the parts to a calling build process.
10
10
 
11
- The following is a table of _some_ of the possible input, processing, and output combos. See [options](#options) for detailed explanation of the processing input.
11
+ The following is a table of _some_ of the possible input, processing, and output combos. See [options](#options) for detailed explanation of the input.
12
12
 
13
13
  | input | processing | output |
14
14
  | ----- | ---------- | ------ |
@@ -58,12 +58,14 @@ The following is a table of _some_ of the possible input, processing, and output
58
58
  ## API
59
59
  This library exports a single function that takes an output directory and processing options.
60
60
  ```
61
- build (outputDir, options)
61
+ build (outputDir, options): Result
62
62
  ```
63
- `outputDir` {String} - Full path to the output directory where css, html, and javascript output are written.
64
63
 
65
- ### Options
66
- One or more of `cssPath`, `jsPath`, and/or `htmlPath` **must** be supplied. They have no default, so if no options are supplied, this library throws an exception.
64
+ ### outputDir {String}, required
65
+ Full path to the output directory where css, html, and javascript output are written.
66
+
67
+ ### Options {Object}, optional*
68
+ \* Not really. One or more of `cssPath`, `jsPath`, and/or `htmlPath` **must** be supplied. They have no default, so if no options are supplied, this library throws an exception.
67
69
 
68
70
  * `cssPath` {String} - Full path to the input css file
69
71
  If supplied:
@@ -71,28 +73,33 @@ One or more of `cssPath`, `jsPath`, and/or `htmlPath` **must** be supplied. They
71
73
  + css will be wrapped in a `style` tag
72
74
  + css will be inserted into the javascript file if `jsReplacement` and `jsPath` are supplied and no `htmlPath` supplied
73
75
  + css will be prepended to the html file if `htmlPath` is supplied
76
+
74
77
  * `cssLinkHref` {String} - link href to a stylesheet resource to be referenced by the web component
75
78
  If supplied:
76
79
  + href will be wrapped in a `link` tag
77
80
  + resulting `link` will be prepended to the html file if `htmlPath` supplied
78
81
  + resulting `link` will be inserted into the javascript file if no `htmlPath` supplied and `jsReplacement` and `jsPath` supplied
82
+
79
83
  * `htmlPath` {String} - Full path to the input html file
80
84
  If supplied:
81
85
  + css will be prepended in a `style` tag
82
86
  + cssLinkHref will be prepended in a `link` tag
83
87
  + html will be inserted into the javascript file if `jsReplacement` and `jsPath` is supplied
88
+
84
89
  * `jsPath` {String} - Full path to the input javascript file
85
90
  * `jsReplacement` {String|RegExp} - The replacement pattern for the css or html in the javascript file. See [pattern](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#pattern) for full documentation
86
91
  If supplied:
87
92
  + A replacement will be attempted in the javascript file
88
- + If **not supplied** or falsy, No replacement will be attempted and all assets are just copied to `outputDir`
93
+ + If **not supplied** or falsy, No replacement will be attempted and all assets are just copied to `outputDir`
94
+
89
95
  * `terserOptions` {Object} - The [javascript minifier options](https://github.com/terser/terser/blob/master/README.md#minify-options) object
90
96
  Defaults:
91
97
  ```
92
98
  {
93
99
  ecma: 2022
94
100
  }
95
- ```
101
+ ```
102
+
96
103
  * `htmlminOptions` {Object} - The [html minifier options](https://github.com/kangax/html-minifier/blob/gh-pages/README.md#options-quick-reference) object
97
104
  Defaults:
98
105
  ```
@@ -103,10 +110,27 @@ One or more of `cssPath`, `jsPath`, and/or `htmlPath` **must** be supplied. They
103
110
  removeAttributeQuotes: true,
104
111
  removeComments: true
105
112
  }
106
- ```
113
+ ```
114
+
107
115
  * `cleancssOptions` {Object} - The [css minifier options](https://github.com/clean-css/clean-css/blob/master/README.md#constructor-options) object
108
116
  Defaults (same as `clean-css` defaults)
109
- * `minifySkip` {Boolean} - True to skip all minifications, defaults to false
117
+
118
+ * `minifySkip` {Boolean} - True to skip all minifications, defaults to false
110
119
 
120
+ ### Result {Object}
121
+ The output of the build process. Allows access to the output paths and full output content. Format:
122
+
123
+ + cssPath {String}, The full path to the output css
124
+
125
+ + htmlPath {String}, The full path to the output html
126
+
127
+ + jsPath {String}, The full path to the output javascript
128
+
129
+ + getCss {asyncFunction}, gets the output css
130
+
131
+ + getHtml {asyncFunction}, gets the output html
132
+
133
+ + getJs {asyncFunction}, gets the output javascript
134
+
111
135
  ## License
112
136
  * [BSD-3 Clasuse, Alex Grant, LocalNerve](LICENSE.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localnerve/web-component-build",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "A library to help build web components",
5
5
  "main": "index.js",
6
6
  "type": "module",